C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] grammar cleanup

From: Aaron Ballman <aaron_at_[hidden]>
Date: Thu, 29 Apr 2021 08:55:45 -0400
On Tue, Apr 27, 2021 at 3:43 AM Jens Gustedt via Liaison
<liaison_at_[hidden]> wrote:
>
> Hello,
> 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.

FWIW, I've been collecting a list of incompatibilities between C and
C++ into a document to help me keep track of where things have
diverged. It seems like at least some of the cases in the list may be
worth exploring if we can improve the compatibility story on. The list
focuses on situations where the same code means different things
depending on which language you're compiling for. (I make no claims
that the list is complete, so if you find things you think should be
added, feel free to suggest edits.)

https://docs.google.com/document/d/16B36r0HksR0LqQAGLA1syYCtZvYaVC0hEF2D00ZAd0o/edit?usp=sharing

~Aaron

>
> 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.
>
> Jā‚‘ā‚™ā‚›
>
> --
> :: 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 ::
> _______________________________________________
> Liaison mailing list
> Liaison_at_[hidden]
> Subscription: https://lists.isocpp.org/mailman/listinfo.cgi/liaison
> Link to this post: http://lists.isocpp.org/liaison/2021/04/0506.php

Received on 2021-04-29 07:56:10