This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: naive GDB programming style questions


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]