Re: ({

Liste des GroupesRevenir à cl c++ 
Sujet : Re: ({
De : acm (at) *nospam* muc.de (Alan Mackenzie)
Groupes : comp.lang.c++
Date : 22. Mar 2025, 12:26:31
Autres entêtes
Organisation : muc.de e.V.
Message-ID : <vrm6p7$2ue$3@news.muc.de>
References : 1 2 3 4
User-Agent : tin/2.6.4-20241224 ("Helmsdale") (FreeBSD/14.2-RELEASE-p1 (amd64))
Bonita Montero <Bonita.Montero@gmail.com> 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).


Date Sujet#  Auteur
20 Mar 25 * ({13Alan Mackenzie
21 Mar 25 +* Re: ({2Bonita Montero
22 Mar 25 i`- Re: ({1Bonita Montero
21 Mar 25 `* Re: ({10Paavo Helde
21 Mar 25  +* Re: ({4Keith Thompson
22 Mar 25  i+* Re: ({2Bonita Montero
22 Mar 25  ii`- Re: ({1Alan Mackenzie
22 Mar 25  i`- Re: ({1Alan Mackenzie
22 Mar 25  +* Re: ({4Alan Mackenzie
22 Mar 25  i+* Re: ({2Paavo Helde
22 Mar 25  ii`- Re: ({1David Brown
22 Mar 25  i`- Re: ({1Alan Mackenzie
1 Apr 25  `- Re: ({1Jakob Bohm

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal