On 14.05.2024 15:47, Jan Beulich wrote:
> On 11.05.2024 01:32, Stefano Stabellini wrote:
>> After looking closely at the R13.1 violations and potential fixes or
>> deviations, upon further reflection and discussions, we realized that it
>> is R13.2, limited to initializers list, that we want to comply with.
>>
>> Link: https://marc.info/?l=xen-devel&m=170751643325805
> 
> The mail you point at is a reply to one where I raised an aspect that was
> never really addressed: 'I'm afraid I don't understand the "eventually
> limiting" part.' Therefore I also don't follow why we'd want to limit
> applicability of this rule to just initializer lists. I'm pretty sure we
> do not want expressions the result of which or any side effects of which
> are unpredictable, no matter where such an expression is used.

Oh, and a formal aspect: I don't think an initializer list counts as
expression. Instead it's a construct involving multiple expressions,
evaluation order of which is unspecified. Specifically

unsigned arr[2] = { i++, i++ };

would violate 13.1 but satisfy 13.2, because 13.2 is concerned of
only each individual expression (and this isn't a comma expression
but a list, somewhat similar to argument lists in function calls).

Surely the compiler would already choke on this, but I wanted to use
a simple example.

Jan

Reply via email to