4 ms·
And (void) in front of printf() is what for exactly?
by huhtenberg 15y ago
And (void) in front of printf() is what for exactly?
- inopinatus 15y agoPhilosophically, it's due to a famous system programmer's dictum: "Always check the return value of system calls". The corollary of this is that one should clearly document when explicitly ignoring the return value. A simple way of this in C becomes a cast to void of the return. Since printf does I/O, it qualifies. Specifically, this code is from a patch to the FreeBSD source which is ruled by style(9); you will find this form throughout BSD source.
- zwp 15y agoIt's to stop lint(1) complaining that you're not checking the return value from printf(). I see you're an old-timer here but maybe you missed out on lint: http://en.wikipedia.org/wiki/Lint_(software) http://en.wikipedia.org/wiki/Lint_(software) That page says it dates from the late seventies; I was still using it mid-nineties. I don't remember the last time that I linted but today Ubuntu is lint-unaware. These days the compiler will pick up most of the things that lint used to.