On 23/04/10 23:51, Paul Eggert wrote: >>>> I believe there is a bunch of places in gnulib which uses memset(P, 0, >>>> sizeof(P)) to initialize structures containing pointers, which wouldn't >>>> be OK if this is not the case. >>> >>> However, GNU Coding Standards states that we can assume that all >>> platforms worth porting to obey the industry convention that NULL maps >>> to all 0 bits, so even if POSIX doesn't guarantee it, gnulib is safe >>> using the idiom. >> >> Right. The portability assumptions for a project becomes a bit more >> complicated to explain though. > > If you want something portable, which will work even on the weird > machines that don't use all-zero-bits for null pointers, you can use > something like the DECLARE_ZEROED_AGGREGATE macro of > coreutils/src/system.h.
The awkward macro is required to suppress warnings. I've asked gcc to relax that particular warning as referenced here: http://www.pixelbeat.org/programming/gcc/auto_init.html cheers, Pádraig.