3 ms·
To avoid the compiler complaining about the unused return value, by telling it I'm explicitly choosing to ignore the value. The complaint doesn't show up on th
by AceJohnny2 8y ago
To avoid the compiler complaining about the unused return value, by telling it I'm explicitly choosing to ignore the value.
The complaint doesn't show up on the default warning levels. I think only with -W ? (fun fact: -Wall actually has fewer warnings enabled than -W, at least with Clang)
Edit: actually, the warning is enabled by default, but only triggers for functions that have the attribute 'warn_unused_result' set, which is almost none of them, which is why this warning is not well-known. Indeed, in my example my (void) isn't necessary, and I couldn't get the warning to trigger even with -Wpedantic.