Deutsch   English   Français   Italiano  
<87bk36syx7.fsf@bsb.me.uk>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Ben Bacarisse <ben@bsb.me.uk>
Newsgroups: comp.lang.c
Subject: Re: question about nullptr
Date: Tue, 09 Jul 2024 10:21:56 +0100
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <87bk36syx7.fsf@bsb.me.uk>
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>
	<87jzhwu5v9.fsf@bsb.me.uk> <20240708001722.280@kylheku.com>
	<v6gab6$qdd2$1@dont-email.me> <878qyctcdt.fsf@bsb.me.uk>
	<20240708192708.531@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Tue, 09 Jul 2024 11:21:56 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="3bc602097df9bef4fe534cf857153f79";
	logging-data="1403793"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19YSX5VTok6UfOOPQn8BzSfIMyLTKo5TKk="
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:UTlyM8yjtrWdDzkKgs7HS+mnw9o=
	sha1:g2AUi7690Heb9ovM6BxiqKs2usE=
X-BSB-Auth: 1.4eda8f48be124d053dde.20240709102156BST.87bk36syx7.fsf@bsb.me.uk
Bytes: 3107

Kaz Kylheku <643-408-1753@kylheku.com> writes:

> On 2024-07-08, Ben Bacarisse <ben@bsb.me.uk> wrote:
>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>>
>>> On 08.07.2024 09:19, Kaz Kylheku wrote:
>>>> On 2024-07-07, Ben Bacarisse <ben@bsb.me.uk> wrote:
>>>>> I find myself completely out of step with many posters here about
>>>>> "explicit code" should look like.  I think
>>>>>
>>>>>   char *p = 0;
>>>>>
>>>>> is explicit enough and, in fact, I consider it a plus point if someone
>>>>> reading it goes "hey, what's going on here?" and ends up learning that 0
>>>>> is null pointer constant in C.
>>>> 
>>>> And if that person is on the C or C++ langauge committee, that bit of
>>>> learning could just prevent a superfluous non-invention like nullptr.
>>>
>>> What's superfluous to one is useful for others (e.g. for grep'ing
>>> occurrences of a null-pointer value in source codes);
>>
>> This is been suggested twice now but I'm struggling to see why that is
>> useful.  I can see management wanting one to find all uses of a null
>> pointer constant to check that they have all been replaced by the
>> "safer" nullptr, but what's the value in searching for nullptr?
>
> We could patch GCC to have a -Wnull-ptr-zero, which will give you a
> diagnostic for every occurrence of a zero valued integer expression that
> becomes a null pointer constant rather than an integer or floating-point
> value (and that isn't cast to pointer type).

Sure.

I once tried to persuade the compiler team where I worked to write a
"tool box" for diagnostics that would have a meta-language in which
users could describe the conditions that wanted to be diagnosed.  The
idea was half-baked so it never went anywhere.

-- 
Ben.