At 05:24 27/06/2009, Xie, Linlin wrote: >I've noticed that that empty pointers are all (am I right?) >initialized to be 0xcdcdcdcd by default. Looks like it's a >debugging value coming from the C runtime library. I wonder if >you have your reason for this to work this way, or better to >initialize them to be 0? it'd be helpful for us that we don't >have to check against this value which is perhaps not platform >independent.
The MSVC debug CRT initialises newly-allocated memory to 0xCD and freed memory to either 0xCC or 0xDD. You should never rely on this behaviour, though -- it is neither portable nor consistent (by design), and the release-mode CRT behaves differently. (The intent is to cause crashes in debug mode if using uninitialised or freed memory, since crashes are easier to find than invalid behaviour from acting on bad data.) If you want to be able to ask "have I set a value for this" later on, then you *must* initialise the values yourself (typically to 0 or NULL) as soon as possible after they are allocated. List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
