Sujet : Re: on allowing "int a" definition everywhere
De : thiago.adams (at) *nospam* gmail.com (Thiago Adams)
Groupes : comp.lang.cDate : 20. Aug 2024, 18:34:04
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <va2k2c$3f4dg$2@dont-email.me>
References : 1 2 3
User-Agent : Mozilla Thunderbird
On 20/08/2024 14:18, fir wrote:
Thiago Adams wrote:
initializer inside if is already in C++, and it will probably be on C2Y.
>
can you show an example how it look like?
#include <stdio.h>
int main()
{
if (FILE* f = fopen("file.txt", "r"); f)
{
/*...*/
fclose(f);
}
if (FILE* f = fopen("file.txt", "r"))
{
/*...*/
fclose(f);
}
}
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3267.htmhttps://en.cppreference.com/w/cpp/language/if