[antlr-interest] Reporting a bug in C Target

David-Sarah Hopwood david-sarah at jacaranda.org
Wed Dec 9 18:00:33 PST 2009


Gokulakannan Somasundaram wrote:
>> Another possibility, if you want to keep the per-member initialisation:
>> what about using 0 as an initialiser rather than NULL?  If I'm remembering
>> the C rules properly (though things are slightly different in C++), 0 is a
>> valid initialiser for every scalar type (integer, floating-point, pointer,
>> enum) -- unlike NULL, which is specifically typed to be a pointer.
>
> Assigning it to 0, will again cause trouble for C++ folks.

No it won't, because 0 is a valid (indeed, the preferred) way of writing
a null pointer constant in C++.

It's actually the other way round -- 0 is not *necessarily* a valid null
pointer constant in C, although it will work as such (but might produce
a warning) in almost all common C implementations.

-- 
David-Sarah Hopwood  ⚥  http://davidsarah.livejournal.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 292 bytes
Desc: OpenPGP digital signature
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20091210/f1ba89aa/attachment.bin 


More information about the antlr-interest mailing list