🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.help
Article #789

Re: NULL = ((void *)0) problem

#789
From: Jason Merrill
Date: Tue, 10 Oct 1995 02:27
19 lines
1503 bytes
>>>>> rjf  <rjf@infograph.com> writes:

> This thread (which I started) has been very interesting, and I
> actually understand some of it -- however, I am curious -- is the
> assertion by the GNU compiler that ANSI does not allow the conversion
> of ((void *)0) to some object pointer valid?

ANSI does not allow implicit conversion from (void *) to any non-void
pointer type; it does not make a special case of (void*)0.  g++ does make a
special case of (void*)0, and allows it to be used as a null pointer
constant in most cases.  Apparently there is a bug such that

A* ap = blarg ();
A* ap2 = foo () ? NULL : ap;

where NULL is defined to be (void *)0 causes an error.  This is a bug in
the extension.

Jason
Technical Details
Message-ID: <u9enwmdqea.fsf@yorick.cygnus.com>
Path: arc1-ca.pugleaf.net!cygnus.com!usenet
References: <435jf3$1iq@globe.indirect.com> <44vqv4$ael@s02.pavilion.co.uk> <4546nd$nnl@oldfart.ecl.wustl.edu> <9528023.17178@mulga.cs.mu.OZ.AU> <45666e$amf@engnews2.Eng.Sun.COM> <KANZE.95Oct9120444@slsvgqt.lts.sel.alcatel.de> <RJF.95Oct09140502@KRUSTY>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!cygnus.com!usenet
From: jason@cygnus.com (Jason Merrill)
Newsgroups: gnu.g++.help,comp.lang.c++
Subject: Re: NULL = ((void *)0) problem
Date: 09 Oct 1995 19:27:41 -0700
Organization: Cygnus Support, Mountain View, CA
Sender: jason@yorick.cygnus.com
Message-ID: <u9enwmdqea.fsf@yorick.cygnus.com>
References: <435jf3$1iq@globe.indirect.com> <44vqv4$ael@s02.pavilion.co.uk>
 <4546nd$nnl@oldfart.ecl.wustl.edu> <9528023.17178@mulga.cs.mu.OZ.AU>
 <45666e$amf@engnews2.Eng.Sun.COM>
 <KANZE.95Oct9120444@slsvgqt.lts.sel.alcatel.de>
 <RJF.95Oct09140502@KRUSTY>
NNTP-Posting-Host: yorick.cygnus.com
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
In-reply-to: rjf@infograph.com's message of 09 Oct 1995 21:05:02 GMT
X-Newsreader: Gnus v5.0