|
Boost : |
From: Jody Hagins (jody-boost-011304_at_[hidden])
Date: 2006-07-05 11:09:58
On Wed, 05 Jul 2006 16:09:17 +0200
Gennaro Prota <gennaro_prota_at_[hidden]> wrote:
> I know how you may feel, believe me. Some time ago I proposed things
> like 0p as null pointer literal, or a new null keyword (the former
> being a palliative for the latter);
0p or null would certainly help clarify the "null-pointer" issue.
I assume you have done something similar to moving code to x86_64?
Those pesky "..." interfaces. Based on Stroustrup's recommendation and
years of practice, our developers use "0" for null pointers, only to be
bitten by passing "0" as a pointer to a vararg function. Oops. On
x86_64, ints are 32 bits, and 0 is passed as an int to a vararg
functions because there is no signature forcing an implicit type
promotion.
I guess you could say to not use vararg functions, but that is
impossible if you also use C libraries. Even if their use is "hidden"
away in library code, at some point you have to make the distinction.
Worse, the problems result in runtime errors... hopefully core dumps in
development and testing.
So... the rule now is to use NULL anytime a vararg function is being
called... 0 otherwise... until we run into the next problem...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk