Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #387498

Re: question about nullptr

From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.lang.c
Subject Re: question about nullptr
Date 2024-08-11 20:52 -0700
Organization A noiseless patient Spider
Message-ID <865xs6gzyi.fsf@linuxsc.com> (permalink)
References (8 earlier) <877cdwu9s1.fsf@nosuchdomain.example.com> <v6if96$18hur$1@dont-email.me> <87y16bw1hf.fsf@nosuchdomain.example.com> <86r0c18gbl.fsf@linuxsc.com> <87h6cxuexa.fsf@nosuchdomain.example.com>

Show all headers | View raw


Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>
>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>
>>> Hmm.  I like the idea of a type-agnostic way to express a "zero"
>>> value, [but] C's use of 0 for all scalar types strikes me more as
>>> an historical accident than a design feature.
>>
>> I don't think it was an accident at all.  It was chosen to be
>> consistent with how if(), while(), !, ?:, and so forth, all act.
>> There is a very consistent design philosophy there.  Sometimes
>> people who come from a strong Pascal background don't like it,
>> but personally I find the C model easier and more convenient to
>> work with than the Pascal model.
>
> In early C, int was in a very real sense the default type.  In B,
> types weren't even explicit, and IIRC variables were effectively "of
> type int", or more precisely a 16-bit PDP-11 word.  (I'm glossing
> over some details of B, many of which I don't know).  In that
> context 0 made sense as a general-purpose "zero" value.

My comment is not about the type but about the value.  That
the constant 0 happens to be of type int is irrelevant to
my conclusions.

Back to comp.lang.c | Previous | NextPrevious in thread | Find similar


Thread

Re: question about nullptr Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-07-10 14:15 -0700
  Re: question about nullptr Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-08-11 20:52 -0700

csiph-web