Path: csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: on allowing "int a" definition everywhere Date: Wed, 28 Aug 2024 08:37:35 -0700 Organization: A noiseless patient Spider Lines: 27 Message-ID: <86a5gwzmio.fsf@linuxsc.com> References: <86o75d1ktx.fsf@linuxsc.com> <87ed69crn5.fsf@nosuchdomain.example.com> <87y14gyb5t.fsf@bsb.me.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Wed, 28 Aug 2024 17:37:35 +0200 (CEST) Injection-Info: dont-email.me; posting-host="6b5ad5f5888a1a6f98ce057847c0415f"; logging-data="3703286"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/pS/ne+rW+rFXCu5Z855L3Cxc36N43pBI=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:34oROGYeIh1liHsb/r7bBFyOHpU= sha1:A3fa6KG6GpIJJFd2Q+h/uAh/QLg= Xref: csiph.com comp.lang.c:387918 Ben Bacarisse writes: > Keith Thompson writes: > >> Tim Rentsch writes: >> [...] >> >>> Not exactly. There are things that can be done inside a >>> statement-expression that are not available inside nested >>> functions or lambdas. >> >> And you're not going to tell us what those things are. > > Apparently not. > > But one thing occurs to me... you can break (or jump) out of a statement > expression: > > for (int i = 0; i < 10; i++) > printf("%d\n", ({ if (i > 5) break; i; })); > > You can't do this with a lambda or nested function. Right. More generally, control transfers to outside the scope of a statement-expression are allowed. That includes break, continue, goto, and importantly return, which returns from the function containing the statement-expression.