(void) fputs( line, stdout );
(void) alarm( TIMEOUT );
The above appears in the function body,I've never seen such code before...
Programming style, also known as code style, is a set of rules or guidelines used when writing the source code for a computer program. It is often claimed that following a particular programming style will help programmers read and understand source code conforming to the style, and help to avoid introducing errors.
K&R style minimises the amount of vertical space which the code consumes, while maintaining that the syntax of the control structure itself does not share lines with its contents. Ensuring a control structure doesn't share lines with its content is important.
Some general advice on good coding style Good code is self-explanatory – the need for comments should be minimal. Comments should be added to those parts of the code where explanations are needed. With code one should not be clever if it is not necessary – do things in an obvious straightforward way.
Classic C doesn't use camel-case; I've written code in camel-case in C, and it looks weird (so I don't do it like that any more). That said, it isn't wrong - and consistency is more important than which convention is used.
It's a form of coding to debugging tools at the expense of human beings reading your code, and it's Considered Harmful. In particular, the classic lint
tool and perhaps some compilers generated warnings if you did not use the return value of a function that returned a value, and the only way to suppress this locally was to cast the result to void
.
Either ignore it, or fix it (remove the useless void
casts) if you have sufficient authority to do so.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With