Untested return values.

Hasan Aljudy hasan.aljudy at gmail.com
Tue Oct 3 11:22:42 PDT 2006


Frits van Bommel wrote:
> 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.

LOL, really?
What does printf return? (what about writef?)



More information about the Digitalmars-d mailing list