Discussion Thread: DIP 1038-- at nodiscard--Final Review

sarn sarn at theartofmachinery.com
Fri Feb 5 21:11:32 UTC 2021


On Friday, 5 February 2021 at 14:16:22 UTC, Paul Backus wrote:
> On Friday, 5 February 2021 at 14:09:09 UTC, claptrap wrote:
>> Cant see the point with stuff like sqrt() though.
>
> It's a generic warning that applies to any discarded expression 
> without side effects. For example, it will also trigger if you 
> write
>
>     1 + 1;

That one's an outright error (without -wi) because if you replace 
the 1s with identifiers, and + with *, you get a parsing 
ambiguity (in C, too):
https://theartofmachinery.com/2020/08/18/d_declarations_for_c_programmers.html#syntax-ambiguities


More information about the Digitalmars-d mailing list