From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin von Loewis To: kaz@cafe.net Cc: g++@cygnus.com, egcs@cygnus.com Subject: Re: implicit declaration in C++ considered harmful Date: Thu, 09 Apr 1998 18:29:00 -0000 Message-id: <199804091921.VAA00415@mira.isdn.cs.tu-berlin.de> References: <01BD62F9.19A03370.kaz@cafe.net> X-SW-Source: 1998-04/msg00403.html > 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''. C++ is the same, here. > A C++ compiler could treat undeclared functions as being implicitly > declared int (...) provided that it emits a diagnostic. Sure it could. I think Joe made his point: even though g++ is currently compliant (in this respect), producing an error would be also compliant. The real question is which one is more desirable. > A conforming C compiler is allowed to translate even a > *syntactically* incorrect program, provided that it diagnoses the > syntax violation! Right. This doesn't mean the compiler *has* to produce a program from incorrect source :-) It may provide some non-standard extensions, whose usage it needs to diagnose. Users of these extensions would expect that they get a working program. The question is whether assuming implicit declarations for global functions is a useful extension. I agree with Joe that it isn't. Regards, Martin