Sujet : Re: ({
De : acm (at) *nospam* muc.de (Alan Mackenzie)
Groupes : comp.lang.c++Date : 22. Mar 2025, 12:00:34
Autres entêtes
Organisation : muc.de e.V.
Message-ID : <vrm58i$2ue$2@news.muc.de>
References : 1 2 3
User-Agent : tin/2.6.4-20241224 ("Helmsdale") (FreeBSD/14.2-RELEASE-p1 (amd64))
Keith Thompson <Keith.S.Thompson+
u@gmail.com> wrote:
Paavo Helde <eesnimi@osa.pri.ee> writes:
[...]
It appears the statement expressions are a gcc extension which does
not even compile in standard C++, and is probably not needed for
anything in C++ as there are better options like templated and inlined
functions.
In C there might be some usage case for it.
[...]
Statement expressions don't compile in *standard* C or C++.
More precisely, they're not standard C or C++. I think it is a shame
they never became part of the standard, as no doubt their developers
intended.
gcc supports them as an extension for both C and C++ (and Objective-C).
There are instances of statement expressions in the Linux kernel,
developed under GCC, and clang was enhanced to support them too so as to
be able to compile Linux. Or so I've heard.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
-- Alan Mackenzie (Nuremberg, Germany).