C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Named Return Value Optimisation [[nrvo]]

From: Simon Schröder <dr.simon.schroeder_at_[hidden]>
Date: Fri, 13 Feb 2026 20:18:21 +0100
> On Feb 13, 2026, at 2:52 PM, David Brown via Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> I am quite convinced the answer is that we /do/ need something that is basically like today's attributes, but not ignorable. However, I am very much open to the idea that this could be "something like attributes" rather than attributes.
>
> Call them "characteristics", and use smiley brackets - (-: ... :-)

We do have two new characters in C++ (@ and $) that could be used for something. We could use one of these for new (context dependent?) keywords. It would look a little nicer than the square brackets of attributes and it certainly doesn’t collide with any existing code.
>
>
> It might also be nice if tools like doxygen and Code Sonar started having [[dox:: ]] and [[sonar:: ]] attributes. Even better would be an independent body defining [[lint:: ]] attributes that Code Sonar, Coverity, and others could use (with gcc and clang supporting what they can). That would hugely benefit developers who want to use multiple tools. And yes, those would /definitely/ be ignorable by other tools!

IIRC in the context of reflection we will get user-defined attributes with the [[=myattribute]] syntax (notice the =). For doxygen we could even reflect over all documentation attributes and write out appropriate documentation (with the current reflection proposal, we can’t write to files at compile time, but we can create a string that is itself C++ code which will be a program that does what we want). In the future we don’t need extra tools (which would have to catch up with new standard syntax), but can do everything at compile time and the fully compliant compiler does the heavy lifting.

Received on 2026-02-13 19:18:35