I
Ingo Menger
Eric said:Let me turn the question around: If you were preparing
a course on C, what features would you omit altogether?
Would you omit `do...while'?
Yes. (Omit)
It's infrequently used, after
all.
And rightly so. Most of the time, it is used by people that did not yet
grasp the concept of zero. For example, you find the "do while" in the
else branch of an if, that tests if there are no elements in a list, or
even worse, the "nothing to do" condition is not anticipated at all.
How about `goto'? It's even rarer, yet your students
will eventually run into it.
I wouldn't omit it, but just mention it and why we don't use it.
`longjmp'? I hope you'd at
least mention that it exists, perhaps with a caution that
it's tricky to use well.
I would not mention it at all. Is longjmp() part of the language C? Is
longjmp() available everywhere?
`long double'? `<stdarg.h>'?
`continue'?
Sure.
What's the difficulty with long double?
A course has to introduce numeric data types, which fall into 2
categories: integral types and floating point types. Once those
concepts are understood, it's just a minute to state that in C we have
3 instances of floating point datatypes: float, double and long double,
the difference between them to elaborate left as homework.
(Alternatively, it's also possible to leave out floating point
entirely, as beginners are not supposed to do number crunching anyway.)