Untested return values.

Walter Bright newshound at digitalmars.com
Tue Oct 3 11:54:35 PDT 2006


Frits van Bommel wrote:
> Lionello Lunesu wrote:
>> What would happen if DMD would issue a compiler warning for untested 
>> return values?
> 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.

I tried this back in the '80s. It's one of those things that sure sounds 
like a good idea. The problem is, there are just too many cases where 
the return value is legitimately ignored (like printf's), so you wind up 
filling your code with chaff like:

	cast(void) printf( ... );

After a few dozen of those, it starts looking like a bad idea <g>.



More information about the Digitalmars-d mailing list