On Thu, Jan 05, 2023 at 02:18:47PM +0100, David Demelier wrote: > On Thu, 2023-01-05 at 13:59 +0100, Claudio Jeker wrote: > > On Thu, Jan 05, 2023 at 11:09:57AM +0100, Theo Buehler wrote: > > > On Thu, Jan 05, 2023 at 11:03:04AM +0100, Claudio Jeker wrote: > > > > gcc4 does not really support C99 initalizers. It works most of > > > > the time > > > > but fails for more complex structs. Just fall back to memset() > > > > here. > > > > > > deraadt used { {0} } in kr_send_dependon(). Apparently that works. > > > I really don't understand why we can't use a 24 years old standard. > > > > It is very annoying. Would be nice if our gcc would allow it since > > c99 > > initalizers are a good thing. Not sure I like the { { 0 } } fix. > > Another > > Also note that = {0} is available since C89, it's only C99 that > introduced designators (e.g. { .foo = 0 }) so there is no reason why > GCC/clang should not accept that unless there is a bug. > > https://godbolt.org/z/6eMWdEEaP >
The problem here is that in C89 you can't use = { 0 } for a struct that is defined like: struct foo { struct bar { int x; } a; int b; }; { 0 } is somewhat special in C99 since it works independent of object. -- :wq Claudio