Xref: utzoo comp.lang.c++:13362 comp.std.c++:906 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!uunet!europa.asd.contel.com!wlbr!voder!pyramid!octopus!sjsumcs!horstman From: horstman@mathcs.sjsu.edu (Cay Horstmann) Newsgroups: comp.lang.c++,comp.std.c++ Subject: Re: Default type of "0" Message-ID: <1991May10.001924.12216@mathcs.sjsu.edu> Date: 10 May 91 00:19:24 GMT References: <74609@brunix.UUCP> <1991May7.162035.9247@odin.diku.dk> Organization: San Jose State University - Math/CS Dept. Lines: 21 In article <1991May7.162035.9247@odin.diku.dk> juul@diku.dk (Anders Juul Munch) writes: > >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, and it >looks like yet another good reason why the implicit conversion of 0 to the >null pointer should be disallowed. >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; > Beware of DOS header files that define NULL as 0L in the large memory model!!! 0L is NOT convertible into a pointer. I got bitten by that one when switching from Glockenspiel to Borland C++ Cay