Here's some advice about how to programme in C:
(From
http://www.uni-muenster.de/ZIV/Mitarbeiter/EberhardSturm/PL1andC.html/)
Or perhaps timidness is not the problem.
Well, I'm going to stick my neck out and say that this list looks quite
a good idea, at least in parts.
The context seems to be that someone who doesn't know much C (and who
isn't intending learning much more) has to, or wants to, write a C
program for some reason. It would seem prudent to assume that the
program might be maintained by either the same programmer or someone
else who knows little C.
While experienced programmers find lines such as:
while ((c = fgetc(file)) != EOF)
a neat way of doing things (it's from Andrew Poelstra's post) it does
look confusing and in my view might be best avoided for a beginner or
inexperienced maintainer.
Now this makes perfect sense. How many times have people posted
perfectly plausible code to clc, saying "why doesn't this work?", and
the answer has been a lack of sequence points. It's possibly the most
frequently asked question here, despite it being in the FAQ.
And what leaps to mind first when you hear the question "Will this
macro work properly?"?
You don't need to use ++ or -- - and if you don't know exactly what
you're doing they are best avoided.
Another popular snag is finding that floating point numbers don't have
exactly the values you were expecting - often revealing itself when a
comparision unexpectedly returns false. You need to be aware of such
things.
The other items on the list also refer to things that could either
cause your program not to work properly, or to make it difficult to
read and understand. So in the context of advice to occasional C
programmers, it seem to all make sense.
Just my tuppenceworth...
Paul.