| Deutsch English Français Italiano |
|
<865xthc1qu.fsf@linuxsc.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!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: Sat, 06 Jul 2024 20:36:09 -0700 Organization: A noiseless patient Spider Lines: 35 Message-ID: <865xthc1qu.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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Sun, 07 Jul 2024 05:36:10 +0200 (CEST) Injection-Info: dont-email.me; posting-host="940a3321ebe7e91666808b6f59645346"; logging-data="199703"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+F1v0YxmmpggRiLT2iTUMsEFsaSclU0vo=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:U/ruKMP0S/JyYqH3PBp+eTYujMw= sha1:5ytJRZnMb9XIZ0ARXHVq0+dLRKc= Bytes: 2450 Ben Bacarisse <ben@bsb.me.uk> writes: > scott@slp53.sl.home (Scott Lurndal) writes: > >> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes: >> >>> On 06.07.2024 14:54, Kaz Kylheku wrote: >>> >>>> On 2024-07-06, Thiago Adams <thiago.adams@gmail.com> wrote: >>>> >>>>> If you were creating C code today and could use a C23 compiler, would >>>>> you use nullptr instead of NULL? >>>> >>>> In greenfield projects under my dictatorship, I use 0, as in: >>>> >>>> char *p = 0; >>>> >>>> I was still 20 something when I (easily) wrapped my head around the 0 >>>> null pointer constant, and have not had any problems with it. >>>> Once I learned the standard-defined truth about null pointer constants, >>>> and their relationship to the NULL macro, I dropped NULL like a hot >>>> potato, and didn't look back (except when working in code bases that use >>>> NULL). >>> >>> We also used 0 as "universal" pointer value regularly without >>> problems. > > I also like to use 0, but I'm not sure I could say exactly why. Maybe > because of pre-C exposure (B and BCPL). Me too. If I had to guess about why, I think I would say (1) being used to it from the original K&R, and (2) it's philosophically consistent with how if(), for(), while(), and logical expressions work. Speaking for myself that consistency is worth a lot, and using NULL sticks out like a sore thumb.