Sujet : Re: on allowing "int a" definition everywhere
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.cDate : 22. Aug 2024, 19:37:09
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240822111551.183@kylheku.com>
References : 1 2 3 4 5 6 7
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2024-08-22, Ben Bacarisse <
ben@bsb.me.uk> wrote:
What's the significance of the declared name being in scope in the else
clause here?
else is a part of the if statement. Everything under the statement
should have visibility to its lexical variable(s).
Otherwise, code like this is prohibited:
if (double x = fun(y); x < 0)
return x * x;
else
return x * y;
-- TXR Programming Language: http://nongnu.org/txrCygnal: Cygwin Native Application Library: http://kylheku.com/cygnalMastodon: @Kazinator@mstdn.ca