Re: P 155 k&r section 7.3
- From: Richard Heathfield <rjh@xxxxxxxxxxxxxxx>
- Date: Sun, 07 Sep 2008 01:02:16 +0000
mdh said:
On Sep 6, 1:23 pm, Richard Heathfield <r...@xxxxxxxxxxxxxxx> wrote:
<snip>
Can you convince me that these diagnostic messages have no significance?
Richard...I would not even try!!! :-)
The point I am making is this: diagnostic messages are issued for a
*reason*.
Now, it is true that, on occasion, the compiler will issue a diagnostic
message even though the code is fine as it is, in much the same way that
you might see a "Caution - vehicles turning" sign whilst out driving, but
visibility is good and there are no blind corners and you can see that
there aren't any vehicles around of any kind, turning or otherwise - so
you can safely put your foot down despite the sign, BECAUSE you understood
the sign, understood its intent, and made a rational decision based on
your knowledge of prevailing conditions.
But, to extend the driving analogy a little further, you would be foolish
indeed to ignore a sign that warns you to take the next blind corner
slowly, yes? Most warning road signs are there for excellent reasons that
apply all or nearly all the time, and a responsible driver will adjust his
driving in keeping with the directions given by the signs.
Similarly, unless you are ASTOUNDINGLY sure that a compiler's diagnostic
message is spurious or, for some excellent reason that you fully
understand, not relevant, you ought to fix your code to get rid of the
message. To do that, you have to understand the message. (For example, the
message "initialization makes pointer from integer without a cast" does
NOT necessarily mean that a cast is the right way to get rid of the
message. It may instead mean that you're missing a header.)
Once you have understood the message, you should fix your code
appropriately, and recompile.
I will try and answer BS with an example.
That won't be necessary if you have properly learned your lesson, i.e. that
you cannot interchange char * and int with carefree abandon just because
you can get it to scrape through compilation.
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.
- Follow-Ups:
- Re: P 155 k&r section 7.3
- From: mdh
- Re: P 155 k&r section 7.3
- References:
- P 155 k&r section 7.3
- From: mdh
- Re: P 155 k&r section 7.3
- From: Keith Thompson
- Re: P 155 k&r section 7.3
- From: mdh
- Re: P 155 k&r section 7.3
- From: Richard Heathfield
- Re: P 155 k&r section 7.3
- From: mdh
- P 155 k&r section 7.3
- Prev by Date: Re: UNIX, C, Perl
- Next by Date: Re: P 155 k&r section 7.3
- Previous by thread: Re: P 155 k&r section 7.3
- Next by thread: Re: P 155 k&r section 7.3
- Index(es):
Relevant Pages
|