C++ Logo


Advanced search

[wg14/wg21 liaison] grammar cleanup

From: Jens Gustedt <jens.gustedt_at_[hidden]>
Date: Tue, 27 Apr 2021 09:43:03 +0200
perhaps we can get on track for a more technical discussion, for which
I think that this reflector and the study group were created. There
are excellent forums out there where people heatedly debate advantages
of their favorite programming languages.

The discussion about multi-dimensions array subscripts has brought to
light that at least one incompatibility in the grammar between C and
C++ has newly been created with C++20, namely that the subscript
operator in C++ only accepts "assignment-expression" and not general
"expression" as is still in C17. If that would been done now, that
would be a typical subject of discussion for this SG, I think.

The other recent incompatibility I am aware of is Martin Uecker's
proposal in C23 for relaxing the places where labels may occur. As far
as I understand there is effort on bringing that to C++, too.

Another field of concern could be selection and iteration statements
where C++ has expanded the grammar by adding the possibility of
declaring variables, similar as to `for`. I personally like that
feature very much, but I wouldn't know if WG14 is ready for it, yet.
In any case it would be good to know if these changes in C++ have
introduced other changes in the grammar for these constructs, similar
to what we have seen for the subscript operator.

I personally would find it a good thing if we could change all
controlling expressions of selection and iteration statements to
"conditional-expression". Yes, this would be change that would
invalidate some existing code, but in a good way ;-) Using a comma
operator or assignment then would be a hard error and it would be easy
for programmers to update their code.


:: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::

Received on 2021-04-27 02:43:11