On 03/24/2015 03:26 PM, Alexey Neyman wrote:
Hi,
I am seeing a strange behavior when a compound initializer is used in a
structure initialization. A test case:
[[[
struct s {
int y;
unsigned long *x;
};
struct s foo = {
.y = 25,
.x = (unsigned long [SZ]){},
};
]]]
If SZ
Regarding undefined behavior: this object has static storage, so I think
6.7.9-10 from C11 should apply:
Strictly speaking, once the behavior of a program is undefined,
even well-defined constructs can have unexpected effects. But
I do agree that dropping initialization for members with a valid
On 03/25/2015 10:09 AM, Martin Sebor wrote:
On 03/24/2015 03:26 PM, Alexey Neyman wrote:
Hi,
I am seeing a strange behavior when a compound initializer is used in a
structure initialization. A test case:
[[[
struct s {
int y;
unsigned long *x;
};
struct s foo = {
.y = 25,
On 25 March 2015 at 18:53, Martin Sebor wrote:
This was my mistake because specifying -ansi after -std=c11
overrides the latter with -std=c90. (It would be nice if
the driver warned about one option overriding another.)
In general that's useful, so you can add e.g. -O0 to the end of a
command
Hi,
I am seeing a strange behavior when a compound initializer is used in a
structure initialization. A test case:
[[[
struct s {
int y;
unsigned long *x;
};
struct s foo = {
.y = 25,
.x = (unsigned long [SZ]){},
};
]]]
If SZ is defined to non-zero, the expected output is