Boost logo

Boost :

From: Richard Damon (rdamon_at_[hidden])
Date: 2001-06-13 12:13:59


By the standard, Vararg functions need to have the null pointer constant
casted to the appropriate pointer type. On systems were all pointers are the
same size you have a better chance of getting away with an uncast NULL then
with 0, as vendors normally try to make it work if they can by using 0L if
that makes it the right size for a pointer, but this is not portable. On
word addressable machines sizeof(void*) > sizeof(int*) so to compiler can
not know at the call site what size null pointer constant to pass.

--
Redirector to current best: Richard_Damon_at_[hidden]
Home: rbrdamon_at_[hidden]
Work: rdamon_at_[hidden]
-----Original Message-----
From: toon [mailto:toon]On Behalf Of Toon Knapen
Sent: Wednesday, June 13, 2001 11:59 AM
To: boost_at_[hidden]
Subject: Re: [boost] boost::nil
> I disagree.  "int *p = 0" is, and has been, the recommended way of
> dealing with null pointers in C++ since several years, and I find it
> easily to understand, easier than parsing "NULL".  That's certainly
> a matter of personal taste.
>
(I have not seen this mentioned on the list before so here goes)
I would like to point you to following good info about porting to 64bit
:
http://www.tru64unix.compaq.com/linux/compaq_cxx/docs/uguport.htm#index_x_22
7
stating that "Using a 0 where you should use NULL generates a 32-bit
constant. On Alpha systems, this could yield 0 in the low 32 bits and
useless data in the high 32 bits when passed into a function that
accepts a variable number of arguments. Using NULL from the <stdio.h>
header file provides the correct value. "
In 32bit everything works out fine whereas it does not when sizeof(T*)
!= sizeof(int)
toon
To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk