Ouch: return values as lvalue

Andrei Alexandrescu (See Website For Email) SeeWebsiteForEmail at erdani.org
Tue Jan 30 19:11:00 PST 2007


Joel C. Salomon wrote:
> Andrei Alexandrescu (See Website For Email) wrote:
>> It's a long discussion. I agree that non-templated code without effect 
>> should issue a compile-time error (not warning) _____as long as under 
>> no change of type definitions etc., the code could make sense_____.
> 
> while(func() == 0)
>     ;
> 
> — or do you only mean that extremely short-lived (effect-less) 
> /assignments/ should be errors?

Code in general. Consider:

1 + 1 == 2;

The code above isn't an error but it also doesn't do anything. It should 
be flagged as an error.

The empty statement in your example is not "code" the way I meant it above.


Andrei



More information about the Digitalmars-d mailing list