Re: question about nullptr

Liste des GroupesRevenir à cl c 
Sujet : Re: question about nullptr
De : andreytarasevich (at) *nospam* hotmail.com (Andrey Tarasevich)
Groupes : comp.lang.c
Date : 09. Jul 2024, 06:45:25
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v6if96$18hur$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9
User-Agent : Mozilla Thunderbird
On 07/07/24 3:17 PM, Keith Thompson 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.
 
Me too.
But at the same time I realize that this is a habit forced upon my by circumstances, by necessity. C (as well as C++) at its beginning (and when I started to use the language) was not very well-suited for type-agnostic/DRY programming. It had a few odd features/idioms acknowledging the possibility, but by large both languages were predominantly type-aware or type-explicit. I reckon, this is actually what made you to "like" such explicitness. But it is pointless to talk about "liking" something, when one really had no choice.
The moment C++ realized the full power of generic/template programming, it immediately rushed head-over-heels into type-agnostic programming style. It was `auto` and `decltype` initially, which then just opened the proverbial floodgates, triggering the avalanche of additional features targeted at the type-agnostic programming style. Many in C++ world still protest it, claiming that old-style type-explicit code is "easier to read", but they are nothing more than overgrown kids being reluctant to take the training wheels off their bikes (since they make it "easier to ride"). There no doubt anymore than type-agnostic programming is the next big thing for C++.
The same goes for C. C is not C++, of course, but with the introduction of `typeof` in C23 and, hopefully, better `_Generic` appearing one of these days, one can hope that being type-explicit is a thing of the past in C as well.
So, no. While I too prefer to use `NULL` for pointers and '\0' for character constants, I realize that do it out of deep-seated habit, or for nostalgic/luddite reasons mostly. Plain undecorated `0` as a universal type-agnostic constant should really be my choice everywhere today.
--
Best regards,
Andrey

Date Sujet#  Auteur
6 Jul 24 * question about nullptr125Thiago Adams
6 Jul 24 +- Re: question about nullptr1Bonita Montero
6 Jul 24 +- Re: question about nullptr1John McCue
6 Jul 24 +* Re: question about nullptr104Kaz Kylheku
6 Jul 24 i+* Re: question about nullptr86Janis Papanagnou
6 Jul 24 ii+* Re: question about nullptr2Janis Papanagnou
6 Jul 24 iii`- Re: question about nullptr1Janis Papanagnou
6 Jul 24 ii+* Re: question about nullptr2Andrey Tarasevich
7 Jul 24 iii`- Re: question about nullptr1Tim Rentsch
6 Jul 24 ii+* Re: question about nullptr2bart
7 Jul 24 iii`- Re: question about nullptr1Keith Thompson
6 Jul 24 ii+* Re: question about nullptr9Chris M. Thomasson
6 Jul 24 iii+* Re: question about nullptr3Chris M. Thomasson
7 Jul 24 iiii`* Re: question about nullptr2Lawrence D'Oliveiro
9 Jul 24 iiii `- Re: question about nullptr1Chris M. Thomasson
6 Jul 24 iii+- Re: question about nullptr1Richard Damon
7 Jul 24 iii+* Re: question about nullptr3James Kuyper
7 Jul 24 iiii`* Re: question about nullptr2Keith Thompson
7 Jul 24 iiii `- Re: question about nullptr1Chris M. Thomasson
7 Jul 24 iii`- Re: question about nullptr1Lawrence D'Oliveiro
7 Jul 24 ii+- Re: question about nullptr1Kaz Kylheku
7 Jul 24 ii`* Re: question about nullptr69Ben Bacarisse
7 Jul 24 ii +- Re: question about nullptr1Tim Rentsch
7 Jul 24 ii +- Re: question about nullptr1Tim Rentsch
7 Jul 24 ii +- Re: question about nullptr1Kaz Kylheku
7 Jul 24 ii `* Re: question about nullptr65Ben Bacarisse
8 Jul 24 ii  +* Re: question about nullptr37Keith Thompson
8 Jul 24 ii  i+- Re: question about nullptr1Janis Papanagnou
8 Jul 24 ii  i+* Re: question about nullptr27Michael S
9 Jul 24 ii  ii+* Re: question about nullptr12Chris M. Thomasson
9 Jul 24 ii  iii`* Re: question about nullptr11Michael S
9 Jul 24 ii  iii `* Re: question about nullptr10Tim Rentsch
9 Jul 24 ii  iii  +* Re: question about nullptr6Thiago Adams
9 Jul 24 ii  iii  i+* Re: question about nullptr3Tim Rentsch
9 Jul 24 ii  iii  ii`* Re: question about nullptr2Thiago Adams
9 Jul 24 ii  iii  ii `- Re: question about nullptr1Tim Rentsch
10 Jul 24 ii  iii  i`* Re: question about nullptr2Kaz Kylheku
10 Jul 24 ii  iii  i `- Re: question about nullptr1Thiago Adams
9 Jul 24 ii  iii  `* Re: question about nullptr3Michael S
9 Jul 24 ii  iii   +- Re: question about nullptr1Tim Rentsch
9 Jul 24 ii  iii   `- Re: question about nullptr1David Brown
9 Jul 24 ii  ii+* Re: question about nullptr4Kaz Kylheku
9 Jul 24 ii  iii`* Re: question about nullptr3Michael S
9 Jul 24 ii  iii +- Re: question about nullptr1Kaz Kylheku
9 Jul 24 ii  iii `- Re: question about nullptr1Tim Rentsch
9 Jul 24 ii  ii`* Re: question about nullptr10Tim Rentsch
9 Jul 24 ii  ii `* Re: question about nullptr9Keith Thompson
9 Jul 24 ii  ii  +- Re: question about nullptr1Chris M. Thomasson
10 Jul 24 ii  ii  `* Re: question about nullptr7Tim Rentsch
10 Jul 24 ii  ii   `* Re: question about nullptr6Keith Thompson
11 Jul 24 ii  ii    +* Re: question about nullptr3James Kuyper
13 Aug 24 ii  ii    i`* Re: question about nullptr2Tim Rentsch
13 Aug 24 ii  ii    i `- Re: question about nullptr1Keith Thompson
13 Aug 24 ii  ii    `* Re: question about nullptr2Tim Rentsch
13 Aug 24 ii  ii     `- Re: question about nullptr1Keith Thompson
8 Jul 24 ii  i+- Re: question about nullptr1Keith Thompson
9 Jul 24 ii  i`* Re: question about nullptr7Andrey Tarasevich
9 Jul 24 ii  i +* Re: question about nullptr2Andrey Tarasevich
11 Jul 24 ii  i i`- Re: question about nullptr1Lawrence D'Oliveiro
9 Jul 24 ii  i `* Re: question about nullptr4Keith Thompson
10 Jul 24 ii  i  `* Re: question about nullptr3Tim Rentsch
10 Jul 24 ii  i   `* Re: question about nullptr2Keith Thompson
12 Aug 24 ii  i    `- Re: question about nullptr1Tim Rentsch
8 Jul 24 ii  `* Re: question about nullptr27Ben Bacarisse
8 Jul 24 ii   +* Re: question about nullptr24Kaz Kylheku
8 Jul 24 ii   i+* Re: question about nullptr22Janis Papanagnou
8 Jul 24 ii   ii+* Re: question about nullptr19Ben Bacarisse
8 Jul 24 ii   iii+* Re: question about nullptr12Janis Papanagnou
8 Jul 24 ii   iiii`* Re: question about nullptr11Ben Bacarisse
8 Jul 24 ii   iiii `* Re: question about nullptr10Janis Papanagnou
9 Jul 24 ii   iiii  `* Re: question about nullptr9Ben Bacarisse
10 Jul 24 ii   iiii   `* Re: question about nullptr8Janis Papanagnou
11 Jul 24 ii   iiii    `* Re: question about nullptr7Ben Bacarisse
12 Jul 24 ii   iiii     `* Re: question about nullptr6Janis Papanagnou
13 Jul 24 ii   iiii      +* Re: question about nullptr3Ben Bacarisse
13 Jul 24 ii   iiii      i`* Re: question about nullptr2Janis Papanagnou
15 Jul 24 ii   iiii      i `- Re: question about nullptr1Ben Bacarisse
13 Jul 24 ii   iiii      +- Re: question about nullptr1Janis Papanagnou
17 Jul 24 ii   iiii      `- Re: question about nullptr1Tim Rentsch
9 Jul 24 ii   iii`* Re: question about nullptr6Kaz Kylheku
9 Jul 24 ii   iii +- Re: question about nullptr1Chris M. Thomasson
9 Jul 24 ii   iii `* Re: question about nullptr4Ben Bacarisse
11 Jul 24 ii   iii  `* Re: question about nullptr3Chris M. Thomasson
11 Jul 24 ii   iii   `* Re: question about nullptr2Ben Bacarisse
11 Jul 24 ii   iii    `- Re: question about nullptr1Chris M. Thomasson
11 Jul 24 ii   ii`* Re: question about nullptr2Lawrence D'Oliveiro
12 Jul 24 ii   ii `- Re: question about nullptr1Janis Papanagnou
8 Jul 24 ii   i`- Re: question about nullptr1Richard Damon
8 Jul 24 ii   `* Re: question about nullptr2James Kuyper
9 Jul 24 ii    `- Re: question about nullptr1Kaz Kylheku
6 Jul 24 i+* Re: question about nullptr4bart
7 Jul 24 ii`* Re: question about nullptr3Lawrence D'Oliveiro
7 Jul 24 ii +- Re: question about nullptr1Keith Thompson
7 Jul 24 ii `- Re: question about nullptr1bart
12 Jul 24 i`* Re: question about nullptr13Richard Harnden
12 Jul 24 i +* Re: question about nullptr4Kaz Kylheku
13 Jul 24 i i`* Re: question about nullptr3Kaz Kylheku
13 Jul 24 i i +- Re: question about nullptr1James Kuyper
13 Jul 24 i i `- Re: question about nullptr1Keith Thompson
14 Jul 24 i +- Re: question about nullptr1Tim Rentsch
16 Jul 24 i `* Re: question about nullptr7Lawrence D'Oliveiro
6 Jul 24 `* Re: question about nullptr18Richard Damon

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal