Untested return values.

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Tue Oct 3 08:20:44 PDT 2006


Lionello Lunesu wrote:
> What would happen if DMD would issue a compiler warning for untested 
> return values?
> 
> bool somefunc() { ... }
> 
> void main() {
>   somefunc();//warning: untested return value
>   auto b = somefunc();//OK
> }
> 
> Especially useful for C or OS functions returning error values or handles.
> 
> L.
> 
> PS. might even be worth a compiler error.

I regularly use functions I don't need the return values of, so I 
wouldn't like this change.

On the other hand, Walter might stop using printf() all over Phobos... :P
Nah, not worth it. Besides, the fact that functions like printf() have a 
return value is probably enough reason for Walter not to make such a change.



More information about the Digitalmars-d mailing list