Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!novia!news-out.readnews.com!transit4.readnews.com!panix!not-for-mail From: jgk@panix.com (Joe keane) Newsgroups: comp.lang.c Subject: Re: possible NULL && dereferencing NULL pointer Date: Wed, 1 Feb 2012 15:15:24 +0000 (UTC) Organization: Public Access Networks Corp. Lines: 17 Message-ID: References: NNTP-Posting-Host: panix3.panix.com X-Trace: reader1.panix.com 1328109324 3946 166.84.1.3 (1 Feb 2012 15:15:24 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Wed, 1 Feb 2012 15:15:24 +0000 (UTC) X-Newsreader: trn 4.0-test76 (Apr 2, 2001) Xref: x330-a1.tempe.blueboxinc.net comp.lang.c:16591 In article , Mark wrote: >I'm not sure that memcmp() will not fail if p_master->bridge is NULL (i.e. >dereferencing NULL pointer), would it be more clear and correct to have: In general, you don't pass NULL to a function that takes 'pointer to so-and-so object', unless you have good evidence that it's allowed, and it does what you want. Otherwise, it will a) crash, or b) do not what you want. The 'strcmp' example is good. What does a NULL argument mean? Is it the same thing as the string ""? Or are NULL and "" two different things? Does NULL compare equal to "NULL"?