[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] Bug report: overriding designated initializers fail to ov
From: |
Petr Skocik |
Subject: |
[Tinycc-devel] Bug report: overriding designated initializers fail to override the previous value |
Date: |
Thu, 13 Feb 2020 12:42:53 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 |
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
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Tinycc-devel] Bug report: overriding designated initializers fail to override the previous value,
Petr Skocik <=