C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] proposal: new const-able feature ( use "const?" , or new "constable" keyword) for method/function
From: Bo Persson (bo_at_[hidden])
Date: 2019-12-18 03:25:10


On 2019-12-17 at 22:20, jianping z via Std-Proposals wrote:
> Thank you and Michael Hava for the updates, it turns out my C++
> knowledge needs to be updated to C++17.
>
> Here are some of my thoughts about your concern,
>
> 1. the "&&?" notation
> we may treat "&&" as a token having two "&", and each "?" can optionally
> remove one "&",
> following the rule, "&&??" can be used to optionally remove two "&" from
> "&&" with "??".
>
> a) const?    -> (), const   //2 variations with single "?"
> b) &?        -> (), &       //2 variations with single "?"
> c) &&?       -> &, &&       //2 variations with single "?"
> d) &&??      -> (), &, &&   //3 variations with double "?" ("??")
>
> here, left side is the notations, right side are the variations of the
> final tokens to replace the notation, "()" means no token (notation removed)
> by explaining "?" like this, developer may able to accept this concept
> easily. though "&?", and "&&??" are hardly needed, but they may still be
> usefully, for example
>

Readability concerns aside, using double question marks gets you very
close to accidentally stumble into trigraphs. Although now formally
removed from C++, several compilers still support them as an extension.

For example, see "What does the C ??!??! operator do?"

https://stackoverflow.com/questions/7825055/what-does-the-c-operator-do

    Bo Persson


STD-PROPOSALS list run by std-proposals-owner@lists.isocpp.org

Standard Proposals Archives on Google Groups