TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: MATHIEU BOUCHARD
from: JONATHAN DE BOYNE POLLARD
date: 1998-01-30 18:42:00
subject: converting char to string

 MB> NULL is defined as being of type void *. If you want to be really
 MB> verbose about the null character, that should be '\0', which will be
 MB> clear enough for everybody:
 MB> 1. people will see it's an ascii char.
 MB> 2. compilers will see it's of type int, which is convertible to char.
I spot a C programmer in the C++ echo !  (-:
Everything that you say is correct for the C language, but is *incorrect* for 
the C++ language.
In Standard C++, NULL does *not* expand to a value of type `(void *)', and 
the character literal '\0' does *not* have the type `int'.
In Standard C++, NULL has the value `0' or `0L', and the type of the 
character literal '\0' is `char'.  See sections 2.13.2 and 18.1 of the C++ 
Standard.
I agree with the underlying point that one should not use the NULL macro when 
what one actually means is the character "NUL", however.
 ¯ JdeBP ®
--- FleetStreet 1.19 NR
---------------
* Origin: JdeBP's point, using Squish (2:440/4.3)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.