C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Every variable is volatile, everything is laundered, no optimisation

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Mon, 28 Aug 2023 00:25:25 +0100
On Sun, Aug 27, 2023 at 11:45 PM Gašper Ažman wrote:
>
> What you want is not expressible *in the standard* without
> decades of work nobody wants to do and nobody wants to implement
> afterwards.


What if we just had an extra sentence tagged onto 'Functions' under
section 9.3.3.5 on page 182 as follows? It could be worded very
generically, the compiler writers would get the jist of it.

9.3.3.5 Functions
1 In a declaration T D where D has the form
    D1 ( parameter-declaration-clause ) cv-qualifier-seqopt
ref-qualifieropt noexcept-specifieropt verbose-specifieropt
attribute-specifier-seqopt
and the type of the contained declarator-id in the declaration T D1 is
“derived-declarator-type-list T”, the type of the declarator-id in D
is “derived-declarator-type-list noexceptopt verboseopt function of
parameter-type-list cv-qualifier-seqopt ref-qualifier opt returning
T”, where
(1.1) — the parameter-type-list is derived from the
parameter-declaration-clause as described below and
(1.2) — the optional noexcept is present if and only if the exception
specification (14.5) is non-throwing
(1.3) — the optional verbose is present if the compiler is to disable
all optimisations inside the body of the function, treating all
objects as though they were volatile, not enforcing aliasing rules,
and not eliding any comparisons or operations even if they appear to
be redundant or to have undefined behaviour. For class objects of type
'volatile', the member function marked 'volatile' is the first choice
to be invoked if it is accessible, otherwise any suitable member
function not marked 'volatile' is invoked. A function marked 'verbose'
cannot also be marked 'inline', and shall not be expanded inline by
the compiler.

Received on 2023-08-27 23:25:32