🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#780
From: Andy J Robb
Date: Thu, 05 Oct 1995 05:38
33 lines
1730 bytes
Ron Forrester <rjf@infograph.com> wrote:
...
>Of course, upon further examination we found that g++ is complaining
>because NULL is defined as ((void *)0). Defining NULL as (0) makes the
>warning go away.
...
IMHO, the ((void*)0) definition was initially a cludge for PC
programmers working with different memory models under ANSI-C
compiling K&R code without prototypes.  This allowed the sizeof NULL
to be correct for all memory models.

However, this cludge may still be required - with 64-bit processors.
It is very likely that pointers will sometimes be 64-bit values -
depending on compiler switches (maybe they already are).  We are
already running a system with 2 GB RAM.  So it makes sense to retain
the ((void*)0) definition of NULL.

It is madness if ANSI C++ allows implict casting of an integral value
of a different size (zero) to a pointer but NOT ((void*)0).

Regards,
Andy Robb.

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: 2.6.2i

mQCNAy/MpRwAAAEEAOt6uBYqT8yv9EmqNhK8m6v+bYi8QjnGW3Bo6iU1gsMj5pa6
MHgq99c8deADbE3cbJ6uZS9v5pZE3WCf6HCQjlB5iULA5RZzMdAumd/WUzuL9UT3
B44D9EqqFIL79FlYb56v4oKFqFp1/J2bIpYUwnUvabGzGjdLrpPl4P16x9sNAAUR
tCNBbmR5IEogUm9iYiA8QUpSb2JiQHBhdmlsaW9uLmNvLnVrPrQhQW5keSBSb2Ji
IDxBSlJvYmJAcGF2aWxpb24uY28udWs+
=/wVD
-----END PGP PUBLIC KEY BLOCK-----
Technical Details
Message-ID: <44vqv4$ael@s02.pavilion.co.uk>
Path: arc1-ca.pugleaf.net!s02.pavilion.co.uk!usenet
References: <435jf3$1iq@globe.indirect.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!s02.pavilion.co.uk!usenet
From: AJRobb@pavilion.co.uk (Andy J Robb)
Newsgroups: gnu.g++.help,comp.lang.c++
Subject: Re: NULL = ((void *)0) problem
Date: Thu, 05 Oct 1995 05:38:14 GMT
Organization: Pavilion Internet plc
Message-ID: <44vqv4$ael@s02.pavilion.co.uk>
References: <435jf3$1iq@globe.indirect.com>
NNTP-Posting-Host: line04.gunn-du.pavilion.co.uk
X-Newsreader: Forte Free Agent 1.0.82