Some examples:
#include <assert.h>
unsigned char map[]= { 255, 255, [0]=11, };
struct xy { int x,y; };
struct xy xy = { 255, 255, .x=11 };
unsigned char map2[]= { [1]=22, [0]=11, };
struct xy xy2 = { .y=22, .x=11 };
unsigned char map3[]= { [0]=255, [0]=11 };
struct xy xy3 = { .x=255, .x=11 };
int main()
{
assert(map3[0]==11 /*&& map3[1]==0*/); //FAILS
assert(xy3.x==11 /*&& xy2.y==0*/); //FAILS
assert(xy2.x==11 && xy2.y==22);
assert(map2[0]==11 && map2[1]==22);
assert(xy.y==255);
assert(sizeof(map) == 2);
assert(map[1]==255);
assert(xy.x==map[0]);
assert(xy.x==11); //FAILS
assert(map[0]==11); //FAILS
}
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel