| Deutsch English Français Italiano |
|
<vsondc$3htha$2@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: David Brown <david.brown@hesbynett.no>
Newsgroups: comp.lang.c
Subject: Re: "A diagram of C23 basic types"
Date: Fri, 4 Apr 2025 15:38:52 +0200
Organization: A noiseless patient Spider
Lines: 43
Message-ID: <vsondc$3htha$2@dont-email.me>
References: <87y0wjaysg.fsf@gmail.com> <vsj1m8$1f8h2$1@dont-email.me>
<vsj2l9$1j0as$1@dont-email.me> <vsjef3$1u4nk$1@dont-email.me>
<vsjg6t$20pdb$1@dont-email.me> <vsjjd1$23ukt$1@dont-email.me>
<vskb2m$2scqh$1@dont-email.me> <vslis6$8mfb$2@dont-email.me>
<vsnhdu$297ra$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 04 Apr 2025 15:38:53 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="c769e35c057c19c3049ecfc31d4accc3";
logging-data="3733034"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19X/6AwpalJ8BJfehC/GbbgPwL7Caadcbo="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:oHZD4/WotdkEb6rzc/xS3AQsiRM=
Content-Language: en-GB
In-Reply-To: <vsnhdu$297ra$1@dont-email.me>
Bytes: 2878
On 04/04/2025 04:50, Janis Papanagnou wrote:
> On 03.04.2025 11:03, David Brown wrote:
>> On 02/04/2025 23:43, Janis Papanagnou wrote:
>>> On 02.04.2025 16:59, David Brown wrote:
>>>> [...]
>>>>
>>>> From the next version beyond C23, so far there is :
>>>>
>>>> 1. Declarations in "if" and "switch" statements, like those in "for"
>>>> loops, helps keep local variable scopes small and neat.
>>>
>>> Oh, I thought that would already be supported in some existing "C"
>>> version for the 'if'; I probably confused that with C++.
>>>
>>
>> C++17 has it.
>>
>> I guess the C committee waited until C++17 had been common enough that
>> they could see if it was useful in real code, and if it lead to any
>> unexpected problems in code or compilers before copying it for C.
>
> Really, that recent!? - I was positive that I used it long before 2017
> during the days when I did quite regularly C++ programming. - Could it
> be that some GNU compiler (C++ or "C") supported that before it became
> C++ standard?
>
> Janis
>
To be clear, we are talking about :
if (int x = get_next_value(); x > 10) {
// We got a big value!
}
It was added in C++17. <https://en.cppreference.com/w/cpp/language/if>
gcc did not have it as an extension, but they might have had it in the
pre-standardised support for C++17 (before C++17 was published, gcc had
"-std=c++1z" to get as many proposed C++17 features as possible before
they were standardised. gcc has similar "pre-standard" support for all
C and C++ versions).