struct init test

xkbcommon
Alessandro Mauri 4 years ago
parent 9564915e08
commit 9866fa0533
  1. 1
      .gitignore
  2. 4
      tests/makefile
  3. 18
      tests/struct_init.c

1
.gitignore vendored

@ -5,3 +5,4 @@ hkd*
tests/parse
tests/ioctl
tests/evtest
tests/struct_init

@ -9,5 +9,7 @@ evtest: evtest.c
inotify: inotify.c
struct_init: struct_init.c
clean:
rm *.o parse ioctl inotify 2> /dev/null
rm *.o parse ioctl inotify struct_init 2> /dev/null

@ -0,0 +1,18 @@
#include <stdio.h>
#define HELL 10
#define IDE 220
#define MAKE_ENTRY(value) {"value", value}
const struct {
const char * const name;
const unsigned short value;
} init[] = {
{"lol", 1},
{"hello", HELL},
MAKE_ENTRY(IDE)
};
int main (void) {
printf("%s\t%d\n", init[2].name, init[2].value);
return 0;
}
Loading…
Cancel
Save