[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: pointers and Windows debugging

From: Branko Čibej <brane_at_xbc.nu>
Date: 2003-01-07 01:05:48 CET

John Barstow wrote:

>Two things I've been noticing in the code lately seem odd. Probably it's
>just my background, but I feel somewhat disquieted by them.
>1) Pointers are not initialized to NULL. This may not matter too much on
>Unix, but on Windows, uninitialized pointers point to random locations in
>memory. This makes debugging very painful and bugs very unpredictable -
>especially since the problem is less pronounced in debug mode.

Initializing pointers to NULL "just in case" is a dangerous practice. It
makes the use-without-initialization bugs harder much to find, because
the NULL init fools the compiler into thinking the pointer was
initialized, even when NULL is not a valid value for that pointer..

Brane Čibej   <brane_at_xbc.nu>   http://www.xbc.nu/brane/
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Jan 7 01:08:51 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.