This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: implicit declaration in C++ considered harmful


On Wednesday, April 08, 1998 7:31 AM, Gabriel Dos Reis 
[SMTP:Gabriel.Dos-Reis@dptmaths.ens-cachan.fr] wrote:

> I think EGCS should be standard conforming and flags implicit
> declaration as an error not a warning.

The C and C++ standards don't distinguish errors and warnings,
though I say this with somewhat less than full confidence because
I'm not as familiar with the C++ draft as with the C standard.

Both types of messages qualify as ``diagnostics''.  A C++
compiler could treat undeclared functions as being implicitly declared
int (...) provided that it emits a diagnostic.

A conforming C compiler is allowed to translate even a
*syntactically* incorrect program, provided that it diagnoses
the syntax violation!

I believe I have seen compilers that produce
an a.out executable from an empty translation unit even
after diagnosing the error!

Another good example is compilers which allow incompatible
pointer assignments to pass by with a mere warning.
This is a constraint violation that requires a diagnostic; it
is as serious as a syntax error. The warning message
serves as an adequate diagnostic, however.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]