public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/7354: NULL not defined correctly for g++ 64-bits
@ 2002-07-18 15:16 craig_files
  0 siblings, 0 replies; 3+ messages in thread
From: craig_files @ 2002-07-18 15:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         7354
>Category:       c++
>Synopsis:       NULL not defined correctly for g++ 64-bits
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 18 15:16:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.0.2
>Organization:
Agilent Technologies
>Environment:
System: HP-UX lathe B.11.00 A 9000/785 2000978003 two-user license


	
host: hppa64-hp-hpux11.00
build: hppa64-hp-hpux11.00
target: hppa64-hp-hpux11.00
configured with: ../gcc/configure --prefix=/usr/local/pa20_64 --enable-languages=c,c++ --host=hppa64-hp-hpux11.00 --target=hppa64-hp-hpux11.00 --with-ld=/usr/ccs/bin/ld --with-gnu-as --enable-libstdcxx-v3
>Description:

NULL is defined (in stddef.h) for C++ as:
#define NULL 0
This is a problem in 64-bit world because the 0 is not a long int, but an int.
Thus, NULL's most significant bits are not set to 0 on initialization and
comparing against NULL is not really 0x00000.

>How-To-Repeat:
	
>Fix:
#define NULL (long int)0 ?
or 
#define NULL ((void*)0)
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: c++/7354: NULL not defined correctly for g++ 64-bits
@ 2002-07-20  9:08 lerdsuwa
  0 siblings, 0 replies; 3+ messages in thread
From: lerdsuwa @ 2002-07-20  9:08 UTC (permalink / raw)
  To: craig_files, gcc-bugs, gcc-prs, nobody

Synopsis: NULL not defined correctly for g++ 64-bits

State-Changed-From-To: open->closed
State-Changed-By: lerdsuwa
State-Changed-When: Sat Jul 20 09:08:34 2002
State-Changed-Why:
    Not a bug.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7354


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: c++/7354: NULL not defined correctly for g++ 64-bits
@ 2002-07-18 21:46 Gabriel Dos Reis
  0 siblings, 0 replies; 3+ messages in thread
From: Gabriel Dos Reis @ 2002-07-18 21:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/7354; it has been noted by GNATS.

From: Gabriel Dos Reis <gdr@merlin.nerim.net>
To: craig_files@agilent.com
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/7354: NULL not defined correctly for g++ 64-bits
Date: 19 Jul 2002 06:41:26 +0200

 craig_files@agilent.com writes:
 
 [...]
 
 | NULL is defined (in stddef.h) for C++ as:
 | #define NULL 0
 | This is a problem in 64-bit world because the 0 is not a long int, but an int.
 
 There is no requirement that NULL in C++ should be of type long int.
 The only thing that is guaranteed is that it is an integral constant
 expression, the exact type of which is unspecified -- it may
 legitimately defined as '\0'.  Programs depending on NULL being of a
 particular value are broken.  Furthermore, NULL is intended to be
 used, suitably *converted*, to provide a null pointer.  That means
 that you'd better explicitly convert NULL to the appropriate target
 (pointer) type when you use it.
 
 [...]
 
 | #define NULL ((void*)0)
 
 This can't be.
 
 -- Gaby


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-07-20 16:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-18 15:16 c++/7354: NULL not defined correctly for g++ 64-bits craig_files
2002-07-18 21:46 Gabriel Dos Reis
2002-07-20  9:08 lerdsuwa

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).