Deutsch English Français Italiano |
<86le2b9ru6.fsf@linuxsc.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!feeds.phibee-telecom.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch <tr.17687@z991.linuxsc.com> Newsgroups: comp.lang.c Subject: Re: question about nullptr Date: Mon, 08 Jul 2024 20:17:37 -0700 Organization: A noiseless patient Spider Lines: 23 Message-ID: <86le2b9ru6.fsf@linuxsc.com> References: <v6bavg$3pu5i$1@dont-email.me> <20240706054641.175@kylheku.com> <v6bfi1$3qn4u$1@dont-email.me> <l9ciO.7$cr5e.2@fx05.iad> <877cdyuq0f.fsf@bsb.me.uk> <2ckiO.19403$7Ej.4487@fx46.iad> <87plrpt4du.fsf@bsb.me.uk> <9bCiO.7108$sXW9.3805@fx41.iad> <877cdwu9s1.fsf@nosuchdomain.example.com> <20240708222804.00001654@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Tue, 09 Jul 2024 05:17:37 +0200 (CEST) Injection-Info: dont-email.me; posting-host="4404f50b61bba69374b6468dfb9554fc"; logging-data="1306957"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18rmSDfYEpFqAvesVkYY5WXBBKAs6onFl4=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:OSm/tqG827nYaM6x551wITjA7V4= sha1:tgTgJpqYdH93gUkDFFFvQ/tppJU= Bytes: 2029 Michael S <already5chosen@yahoo.com> writes: > On Sun, 07 Jul 2024 15:17:34 -0700 > Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote: > >> I just about always use NULL, not 0, when I want a null pointer >> constant. Similarly, I use '\0', not 0, when I want a null character, >> 0.0 when I want a floating-point zero, and false when I want a Boolean >> zero. I just like being explicit. > > Pointer: I very rarely use NULL. > Character: I never use '\0'. > Floating point: I never use 0.0. > Boolean: I use false much more often than 0. This posting has inspired me to try using (long)0.0 whenever a null pointer constant is needed. As for example (void*){ (long)0.0 } as an argument to a variadic function where a pointer is expected.