Re: question about nullptr

Liste des GroupesRevenir à cl c  
Sujet : Re: question about nullptr
De : tr.17687 (at) *nospam* z991.linuxsc.com (Tim Rentsch)
Groupes : comp.lang.c
Date : 07. Jul 2024, 04:10:50
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <86ed85c2x1.fsf@linuxsc.com>
References : 1 2 3 4 5 6
User-Agent : Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
scott@slp53.sl.home (Scott Lurndal) writes:

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).
>
Whereas I spent 6 years programming on an architecture[*] where a
null pointer was represented in hardware by the value 0xc0eeeeee.  I always
use the NULL macro in both C and C++ code.
>
I'm sure you know (but maybe some other readers might not) that that
does not stop one using 0 in C source code.  Whatever a null pointer
"really" is on some hardware, 0 must work in C, including in comparisons
with == and !=.  You can have
>
Yes.  However, I consider that ambiguous, [...]

You consider something that is not ambiguous to be ambiguous?  You must
mean something different by the word ambiguous than I do.

Date Sujet#  Auteur
1 Jul 25 o 

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal