naive GDB programming style questions
Andrew Cagney
ac131313@ges.redhat.com
Tue Sep 10 16:15:00 GMT 2002
> On 09 Sep 2002 20:52:14 -0700, David Carlton <carlton@math.Stanford.EDU> said:
>
>> On Mon, 09 Sep 2002 21:45:54 -0400, Andrew Cagney <ac131313@ges.redhat.com> said:
>
>
>>> If you've a copy of the ISO C and C++ manuals, have a look at what
>>> they have to say about ``NULL'' pointers. It's weird.
>
>
>> Though if you're referring to the fact that NULL's underlying bit
>> representation might not be 0, I'm not sure that's a big deal here.
>
>
> Actually, that raises another question: if I'm allocating an array of
> pointers that I want initialized to NULL, am I allowed to use
> xcalloc() to handle that, or do I have to loop through the memory
> myself to set all the pointers to NULL? Because the former is
> technically incorrect, but I don't know if GDB runs on any platforms
> for which it wouldn't work; I think I've seen parts of GDB initialize
> pointers to NULL using xcalloc or memset, but maybe I'm wrong.
You can use memset() and xcalloc().
Andrew
More information about the Gdb
mailing list