[antlr-interest] Reporting a bug in C Target

Jim Idle jimi at temporal-wave.com
Wed Dec 9 06:56:58 PST 2009


Problem is that I agree with all the points made ;-) Definitely with not relying on uninitialized values. 

I will look again at not initializing things that I don't know the type of as I no longer remember why that was going to be an issue. If I thought that all C users would be fine with that, then I would not do it. I know that the generated code relies on certain things being initialized - maybe that was the issue. I'll come back to the list on this one and comment the source definitively.

Jim

> -----Original Message-----
> From: Gavin Lambert [mailto:antlr at mirality.co.nz]
> Sent: Wednesday, December 09, 2009 1:52 AM
> To: Gokulakannan Somasundaram; Jim Idle
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Reporting a bug in C Target
> 
> At 14:07 9/12/2009, Gokulakannan Somasundaram wrote:
> >Actually, i want to suggest the memset option only for making it
> >work with enums and not with C++ objects as i mentioned before.
> >Since people expect C target to work with enums, i made that
> >suggestion.
> 
> 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.
> 
> Though I'm still not entirely convinced that there should be any
> default initialisation at all.  If people are relying on the
> values of uninitialised variables then they deserve the weirdness
> they get... ;)






More information about the antlr-interest mailing list