casting unused return values to void

Posted by markh44 on Stack Overflow See other posts from Stack Overflow or by markh44
Published on 2009-03-27T13:00:59Z Indexed on 2010/03/13 13:15 UTC
Read the original article Hit count: 365

Filed under:
|
|
int fn();

void whatever()
{
    (void) fn();
}

Is there any reason for casting an unused return value to void, or am I right in thinking it's a complete waste of time?

Follow up:

Well that seems pretty comprehensive. I suppose it's better than commenting an unused return value since self documenting code is better than comments. Personally, I'll turn these warnings off since it's unnecessary noise.

I'll eat my words if a bug escapes because of it...

© Stack Overflow or respective owner

Related posts about c

    Related posts about c++