jaysome said:
[the following compilers produce the following warnings]
foo.c: In function 'main':
foo.c:5: warning: the address of 'fclose', will always evaluate as
'true'
Microsoft VC++ 6.0 and Visual Studio 2005
(
http://msdn2.microsoft.com/en-us/express/):
foo.c(5) : warning C4550: expression evaluates to a function which is
missing an argument list
Comeau online compiler (
http://www.comeaucomputing.com/tryitout/):
"ComeauTest.c", line 5: warning: controlling expression is constant
if ( fclose )
^
PC-lint (
http://www.gimpel.com):
foo.c(5) : Warning 506: Constant value Boolean
[which are all accurate, as far as they go; he then notes in his
signature that:]
It is ironic that in its warning message gcc incorrectly separates the
subject (address) from the verb phrase (will always evaluate) with a
comma, in light of the fact that the "-pedantic" option was specified.
The moral of the story is that the "-pedantic" option in no way
contrues that gcc will be pedantic about English grammar.
Indeed (though you have a typo here -- you mean "construes" -- and
"construing" is something done by an entity that reasons, so you
probably should have said "implies"
).
And neither Microsoft nor Gimpel commit such an egregious faux paus
in their warning messages.
(In keeping with the grand tradition, this also has an error: it
should read "faux pas".
)
Microsoft's warning does leave something to be desired, however.
As written, it claims that the expression evaluates to a function
-- it does not; it evaluates to a *pointer to* a function -- and
that the function in question is missing an argument list. The
function itself cannot be missing an argument list; only a *call
to* a function can be missing an argument list, and then only if
there is a prototype in scope for the call. Besides getting this
subtle distinction wrong, the Microsoft diagnostic also uses "which"
in a restrictive clause; some (many?) grammarians frown on such
uses, preferring the word "that".
(I find Comeau's warning the clearest and most succinct, myself.
GCC's is the second clearest, accurately pointing out that fclose
is never called, but containing the odd sentence structure you
noted.)
Note: since the above is largely commentary on English language
usage, it must necessarily contain errors of spelling, typography,
and/or grammar.