C++ Logo

std-discussion

Advanced search

Re: Optional Semicolons

From: William Linkmeyer <wlink10_at_[hidden]>
Date: Thu, 28 Apr 2022 13:35:44 -0400
Correction:

> *both* of these conditions are *met*

WL

> On Apr 28, 2022, at 1:34 PM, William Linkmeyer <wlink10_at_[hidden]> wrote:
>
> Some things will potentially change meaning — yes. But none of the examples here need to break existing code.
>
> We could optionally elide semicolons if — and only if — one or both of these conditions are meta:
>
> 1. A statement could end with a semicolon and be syntactically acceptable
> 2. A statement is followed by another statement which also satisfies (1)
>
> Perhaps (2) could be modified as “… or by the end of the current scope.”
>
> WL
>
>>> On Apr 28, 2022, at 1:26 PM, Matthew Woehlke <mwoehlke.floss_at_[hidden]> wrote:
>>>
>> On 28/04/2022 13.11, William Linkmeyer via Std-Discussion wrote:
>>> Hello,
>>> I’ve been considering writing a paper which allows the programmer to elide semicolons when the statement is otherwise followed by any number of whitespace and a newline.
>>> This would *only* apply to statements — function and class declarations and prototypes would be left untouched.
>>
>> Hmm. So this (potentially¹ perfectly legal code):
>>
>> int x = 5
>> *y = 7;
>>
>> ...will suddenly mean something completely different? Seems like a non-starter.
>>
>> (¹ Okay, I needed an `int& operator*(int, decltype(y))`, but I doubt this is the only pathological example in existence.
>>
>> --
>> Matthew

Received on 2022-04-28 17:35:46