Re: Pointers

From: Chris Gilbert (chris@buzzbee.freeserve.co.uk)
Date: 11/12/99


Zeavon Calatin wrote:
>
> > This is probably a stupid thing to be asking, but here's my
> > question. Does
> > it matter if when you define a pointer if you set it as NULL
> > or not? i.e.
> > is:
>
> It's like wearing your seatbelt... So long as you don't get in a wreck, it's
> safe to not wear one.
>
> Basically, NOT explicity setting pointers to NULL is just asking for
> trouble.

Something probably worth noting is that VC++ 6 does intialise things
(not sure if that's debug mode only) to 0xcdcdcdcd.  Or it's something
like that, in which case you're definetly asking for trouble not doing
so.  Never assume anything about C, or your compiler.

For local variables it's probably less of a problem, as you normally
define things fairly quickly, and gcc does warn if something is possibly
unintialised before use.

Chris


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST