Compilers and programming style (was Re: A question of style)
Mike Schilling
mikes at rtech.UUCP
Sun Dec 24 05:38:25 AEST 1989
>From article <1989Dec22.100135.2903 at gdt.bath.ac.uk>, by exspes at gdr.bath.ac.uk (P E Smee):
> A compiler should *never* of its own choice put out gratuitous warnings
> about valid constructs, as many places will not allow release of code
> unless it compiles with NO messages at all; and because a compiler which
> forces you to ignore chatty messages will someday lead you to miss an
> important one.
How about this:
sub()
{
extern void (*ptr)();
*ptr; /* Should be (*ptr)(), of course */
}
This is legal c, but almost certainly *not* what was intended. Most compilers
I've used don't flag this as an error, or even a warning. In fact, there was
a posting in comp.lang.c yesterday by someone who did this, and couldn't figure
out why his function wasn't being called. Isn't a chatty message in order?
More information about the Comp.lang.c
mailing list