Untested return values.

Lionello Lunesu lionello at lunesu.remove.com
Tue Oct 3 13:42:03 PDT 2006


"Frits van Bommel" <fvbommel at REMwOVExCAPSs.nl> wrote in message 
news:eftv4g$2ueh$1 at digitaldaemon.com...
> 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.

Damn that printf :S

I actually use the printf in D quite a lot, but only because it's there. If 
writefln would be imported by default I'd use that instead.

L. 





More information about the Digitalmars-d mailing list