Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: int a = a (Was: Bart's Language)
Date: Thu, 20 Mar 2025 01:32:54 -0700
Organization: A noiseless patient Spider
Lines: 48
Message-ID: <868qp0p0eh.fsf@linuxsc.com>
References: <86zfhhpl5n.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Thu, 20 Mar 2025 09:32:55 +0100 (CET)
Injection-Info: dont-email.me; posting-host="7c01e97b5d1836204810413d59dbf156";
logging-data="2981858"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX188/g1x5Cx8lgMqw83CtFK+T296x3JiN9U="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:HhRFlE9ucBDoXUPr7JUq6blIfsg=
sha1:E9ZYsfHPUdrVSN3irBoMNasKGuo=
Bytes: 2859
Rosario19 writes:
> On Tue, 18 Mar 2025 23:52:20 -0700, Tim Rentsch wrote:
>
>> (Kenny McCormack) writes:
>>
>>> David Brown wrote:
>>> ...
>>>
>>>>> gcc won't warn until you say '-Wextra', and then only for:
>>>>>
>>>>> int a = a + 1;
>>>>
>>>> People would not normally write "int a = a;". It is used as a
>>>> common idiom meaning "I know it is not clear to the compiler
>>>> that the variable is always initialised before use, but /I/
>>>> know it is - so disable the use-without-initialisation warnings
>>>> for this variable". So it makes perfect sense for the compiler
>>>> not to warn about it!
>>
>> An addle-brained view. Anyone who thinks that should be forcibly
>> removed from any activity involving software development.
>>
>>> Wouldn't it just be easier and clearer to write: int a = 0;
>>> and be done with it?
>>
>> There are two problems: one, the semantics are different; and
>> two, the impression given of the author's intent is different.
>> It's kind of like saying "isn't it just easier and clearer to
>> write 'red' rather than 'yellow'?" Writing 'int a = 0;' might be
>> better or it might be worse, depending on one's point of view,
>> but it shouldn't be considered either more clear or less clear,
>> because it isn't saying the same thing.
>
> int a=a;
> for me initialize "a" variable with a value the compiler found
> right as in
>
> int a;
>
> only possibly silence compiler warning for variable not
> initializated
If you want to take it that way, there is nothing wrong with
that.
But it's a mistake to assume everyone else will also take it to
mean the same thing that you do.