R
Richard Heathfield
ipo said:I do not necessarily agree with your views on the use of casts. There are
millions of lines of C code lying around that date back to the early days
that still need to be maintained. In more than one occassion I've seen
entire rooms with hundreds of volumes of source code printouts that had no
documentation whatsoever because it got lost the last time the company
moved. Faced with that the last thing that would cross my mind would be to
upgrade compilers.
If you're stuck with an old compiler, so be it. But most newbies aren't, and
would be better off learning that unnecessary casting is always bad.
[...] However, note that Section 5.1.2.2.1.1 of the ISO C
Standard (ISO/IEC 9899:1999) does allow for the definition of void main(),
even if at the price of portability.
It also allows for the definition of double main(), char *main(), and struct
{ float (*fp)(char *, float, double); int i; } main(), but I don't see
{ you
advocating those anywhere. Why not? Could it be because they're not
portable? Well, neither is void main(). Your position is inconsistent.
I do not advocate those because they're not as widespread as void main().
Many erroneous constructs are widespread. That doesn't mean we have to keep
spreading them wider and wider.
<snip>