Path: ...!feeds.phibee-telecom.net!news.mixmin.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail From: Alan Mackenzie Newsgroups: comp.lang.c++ Subject: Re: ({ Date: Sat, 22 Mar 2025 11:26:31 -0000 (UTC) Organization: muc.de e.V. Message-ID: References: <87ldsyqj40.fsf@nosuchdomain.example.com> Injection-Date: Sat, 22 Mar 2025 11:26:31 -0000 (UTC) Injection-Info: news.muc.de; posting-host="news.muc.de:2001:608:1000::2"; logging-data="3022"; mail-complaints-to="news-admin@muc.de" User-Agent: tin/2.6.4-20241224 ("Helmsdale") (FreeBSD/14.2-RELEASE-p1 (amd64)) Bytes: 1872 Lines: 33 Bonita Montero wrote: > Am 21.03.2025 um 20:27 schrieb Keith Thompson: >> Statement expressions don't compile in *standard* C or C++. > In C++ you could use lambdas for that. The sort of thing statement expressions are good at are the likes of (C example): while ({ ch = getch (); ch = toupper (ch); ch != 'Q'; }) switch (ch) { .... } , the loop of a command processing function which takes single case insensitive commands from the keyboard. While it is true that this example could be rewritten using the comma operator in place of the statement expression, it would only need to be slightly more complicated to make this impractical. Yes, in C++, a lambda could be used instead, but this is somewhat artificial and would have more boilerplate cluttering up the actual code. Anyhow, I haven't actually done any real C++ hacking for about 20 years, I just try to keep Emacs's C++ Mode working. -- Alan Mackenzie (Nuremberg, Germany).