public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kaz Kylheku <kaz@cafe.net>
To: "'egcs@cygnus.com'" <egcs@cygnus.com>
Subject: FW: Pointer woes... (int) 0 or (void *) 0 for NULL???
Date: Wed, 11 Mar 1998 09:31:00 -0000	[thread overview]
Message-ID: <01BD4CD0.E9408470.kaz@cafe.net> (raw)

On Tuesday, March 10, 1998 4:24 PM, Mark Schaefer [SMTP:mschaefer@dsai.com] 
wrote:

> Seems like a real catch-22 to me, except that case 1 is written to the
> standard that
> " Because of standard conversions, 0 can be used as a constant of any
> integral, floating-point, pointer, or pointer-to-member type."
>
> Any help on this one?

It really sounds like NULL has not been defined as 0 even though you
think it has.

Repeat your tests with 0 substituded for NULL. Also, in the functions
where the problesms arise, add a diagnostic like:

	cout << "NULL is defined as " << STR(NULL) << endl;


Prior to this, add the following #define's somewhere:

	#define XSTR(X) #X
	#define STR(X) XSTR(X)

This ensures that STR(NULL) turns into a string literal containing
the replacement tokens for NULL.


Remember, in C and C++, you trigger undefined behavior if you
redefine a macro without #undef'ing it first! So if a NULL already
exists and you redefine it, anything may happen, including the
possibility that the old version prevails.

You may only redefine macros if you redefine them with the
exact same replacement text (including same whitespace
separation).


             reply	other threads:[~1998-03-11  9:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-03-11  9:31 Kaz Kylheku [this message]
1998-03-12 16:29 ` Mark Schaefer
1998-03-13 18:29   ` Branko Cibej
1998-03-13 18:47   ` Joe Buck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=01BD4CD0.E9408470.kaz@cafe.net \
    --to=kaz@cafe.net \
    --cc=egcs@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).