Kenneth Brody wrote:
Mike Wahler wrote:
"prasanna" <sv**********@i ndiatimes.com> wrote in message
news:11****** *************** *********@local host.talkaboutp rogramming.com. ..
i will be very thankful if you sent all the errors and warnings regarding
to the language C
The language standard requires an implementation to issue
a diagnostic message for certain language rule violations.
The actual text of such messages is not specified. I.e.
every message could be simply e.g. "ERROR!". "Warnings" are
not required at all. Most implementations do provide somewhat
meaninful warnings and errors, and each will have their own.
Consult your documentation.
Can a compiler "make up" its own warnings? Could a conforming compiler
issue a warning if the definition of main() didn't start on an odd-numbered
line, or if you used the "wrong" method of placing braces?
$ yuckycc -c foo.c
foo.c:8 Warning! Definition of main() should be on an odd-numbered line.
foo.c:10 Warning! I don't like variables named "j".
foo.c:12 Warning! Braces belong indented below the if() line.
foo.c:297 Warning! Length of source file exceeds the day of the year.
Yes, of course.
foo.c:1 Warning! Using "foo" as a file name is deprecated.
foo.c:42 Warning! This really isn't The Answer.
foo.c:56 Accolade! malloc() used without a cast.
However, if the program is correct the implementation must
accept and attempt to execute it, no matter how many warnings
or other diagnostics it has issued.
There's no straightforward technical criterion by which
one can determine whether a particular warning is superfluous
or essential: it's matter of the expected "error styles" of the
users. When the compiler draws attention to perfectly correct
C code, it may just be making useless noise -- but on the other
hand, it may be saving your butt.
switch (what) {
case 1:
x = f();
break;
case 2:
x = g();
break;
case3:
x = h();
break;
}
.... is perfectly good C, yet I for one would be glad to be warned
that `x = h();' is not reachable, or that the label `case3' is
not used.
It's a QoI ("Quality of Implementation" ) issue -- and "Q"
is neither one-dimensional nor even measured the same way by
all users of the compiler.
--
Er*********@sun .com