Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c++ Subject: Re: NULL versus 0 Date: Sun, 26 Sep 2021 15:03:42 -0700 Organization: None to speak of Lines: 30 Message-ID: <871r5bkn9d.fsf@nosuchdomain.example.com> References: <21138a34-469b-4c7a-9ef1-e9307ba52673n@googlegroups.com> <87a6jzlmu6.fsf@nosuchdomain.example.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="39ff22a84492e5ec37e25bfe4071ee27"; logging-data="13796"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+q8AbIvGETRfyh7AojmWEH" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:KDfREEcik4X5IBvPG9AtVWnfd4Y= sha1:TcIuWo+Lp3OMn3uyqJ8Ct9vXiRA= Xref: csiph.com comp.lang.c++:81605 Branimir Maksimovic writes: > On 2021-09-26, Keith Thompson wrote: >>> #define NULL (void*)0 >>> simple, problem is that in C++, one have to cast from void >>> and that does not works, and this is BuG in C++. >> >> That's not a valid definition of NULL in either C or C++. >> >> In C or C++, the definition has to be parenthesized to avoid parsing >> errors in some contexts; >> >> #define NULL ((void*0) >> >> I'm not sure what you mean by "this is BuG in C++". A C++ >> implementation that defined NULL that way would be non-conforming. >> > Exactly, that is why it is Bug. > Thanks for correction, BTW. To be clear, you're saying that if any C++ implementation actually defined NULL that way, it would be a bug in that implementation. That's true, but I'm not aware of any implementation that actually has that hypothetical bug. It can require some trivial extra work for an implementation that shares headers between C and C++, but implementers are well aware of the issue. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Philips void Void(void) { Void(); } /* The recursive call of the void */