From -6505035715051416774
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,da46f9d6feb862e5
X-Google-Attributes: gidf78e5,public
From: Martin von Loewis <loewis@informatik.hu-berlin.de>
Subject: Re: Is this well-formed?
Date: 1999/04/22
Message-ID: <p6qaew07bqe.fsf@pandora.inst-inf-1.hu-berlin.de>#1/1
X-Deja-AN: 469735261
Approved: Valentin Bonnard <bonnard@clipper.ens.fr>
References: <7f1nnv$6c$1@weber.techno-link.com> <371655EE.948EA1E6@technologist.com> <QQglev00422.199904161429@relay7.UU.NET> <371F37BE.E9ED31D@physik.tu-muenchen.de>
X-Original-Date: 22 Apr 1999 20:26:33 +0200
Content-Type: text/plain; charset=US-ASCII
Organization: Humboldt-University Berlin, Department of Computer Science
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUANx+dF6wEuYhIxRhxAQGaVwH8D/IvJhQ8FcF/ad8q0rVhfQlLVd/VTfAd EwEQKO2olowjGK6MjRAOn0LlZMo+Frfm4AEDVifV45HeTHINcfvjaw== =5Hdu
Mime-Version: 1.0 (generated by tm-edit 7.106)
Newsgroups: comp.std.c++

Christopher Eltschka <celtschk@physik.tu-muenchen.de> writes:

> void f(int) { cout << "foo" << endl; }
> void f(char*) { cout << "bar" << endl; }
[...]
>   f(NULL); // prints foo again

Is that really guaranteed? I'd think

#define NULL 0L

would be a conforming definition of NULL. Then, calling f(int) would
require an integral conversion, and calling f(char*) would require a
null-pointer conversion, which both have conversion rank. In that
case, the call could be ambiguous. Under no circumstances, f(char*) is
called.

Regards,
Martin
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]



