Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #16591

Re: possible NULL && dereferencing NULL pointer

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 <jgbkuc$3ra$1@reader1.panix.com> (permalink)
References <jg7srm$ka8$1@speranza.aioe.org>
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

Show key headers only | View raw


In article <jg7srm$ka8$1@speranza.aioe.org>,
Mark <mark_cruzNOTFORSPAM@hotmail.com> 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"?

Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

possible NULL && dereferencing NULL pointer "Mark" <mark_cruzNOTFORSPAM@hotmail.com> - 2012-01-31 00:05 -0500
  Re: possible NULL && dereferencing NULL pointer Devil with the China Blue Dress <chine.bleu@yahoo.com> - 2012-01-30 21:39 -0800
    Re: possible NULL && dereferencing NULL pointer Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-01-31 08:25 +0000
    Re: possible NULL && dereferencing NULL pointer Keith Thompson <kst-u@mib.org> - 2012-01-31 00:28 -0800
      Re: possible NULL && dereferencing NULL pointer Devil with the China Blue Dress <chine.bleu@yahoo.com> - 2012-01-31 00:33 -0800
        Re: possible NULL && dereferencing NULL pointer Keith Thompson <kst-u@mib.org> - 2012-01-31 02:31 -0800
          Re: possible NULL && dereferencing NULL pointer Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-01-31 04:54 -0800
      Re: possible NULL && dereferencing NULL pointer gwowen <gwowen@gmail.com> - 2012-01-31 02:30 -0800
        Re: possible NULL && dereferencing NULL pointer Keith Thompson <kst-u@mib.org> - 2012-01-31 13:20 -0800
  Re: possible NULL && dereferencing NULL pointer Robert Wessel <robertwessel2@yahoo.com> - 2012-01-31 01:12 -0600
  Re: possible NULL && dereferencing NULL pointer Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-01-31 12:33 +0000
  Re: possible NULL && dereferencing NULL pointer jgk@panix.com (Joe keane) - 2012-02-01 15:15 +0000

csiph-web