Xref: utzoo comp.lang.c++:13352 comp.std.c++:903 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!caen!uflorida!screamer!tscs!tct!chip From: chip@tct.com (Chip Salzenberg) Newsgroups: comp.lang.c++,comp.std.c++ Subject: Re: Default type of "0" Message-ID: <282980FB.6AB7@tct.com> Date: 9 May 91 17:03:55 GMT References: <74609@brunix.UUCP> <1991May7.162035.9247@odin.diku.dk> Organization: Teltronics/TCT, Sarasota, FL Lines: 28 According to juul@diku.dk (Anders Juul Munch): >But I wonder, if we have > #define NULL 0 >(which is ANSI C compliant, I don't know if C++ is any different), then >f(NULL) would call f(int)?! This seems highly unreasonable to me ... That's the fact, Jack. When in doubt, cast. >looks like yet another good reason why the implicit conversion of 0 to the >null pointer should be disallowed. Too late for that; implicit conversion of 0 to a pointer isn't even a C++ invention. As an ANSI C feature, I doubt it will disappear. >Instead, NULL should be used whenever a null pointer is needed. NULL being >defined as > #define NULL ((void*)0) >And > int* ip = 0; >would then be illegal, and replaced by > int* ip = NULL; Sorry, that won't work. The ARM explicitly disallows automatic (castless) conversion of a |void*| to another pointer type. -- Brand X Industries Sentient and Semi-Sentient Being Resources Department: Because Sometimes, "Human" Just Isn't Good Enough [tm] Chip Salzenberg ,