Topic: missing prototype warning (was prototypes required?)
Author: Darin Adler <darin@bentspoon.com>
Date: 2000/04/06 Raw View
In article <8cfr0s$77t$1@nnrp1.deja.com>, Jim Hyslop
<jim.hyslop@leitch.com> wrote:
> Certain compilers will issue a warning that you have not prototyped
> Hello(), but that's (IMO) a bogus warning. There is nothing to stop a
> compiler from issuing any warnings it wants to. "Warning 1234: Code
> was last modified on a Monday morning. Are you sure you weren't
> suffering from a hangover?"
The logic behind this warning is the following usage model that some
programmers adopt:
Functions that are private to a file should be declared using an unnamed
namespace or with internal linkage ("static" keyword). Functions that
are not private should have declarations in a header file.
Thus, if you have a function that's defined with internal linkage and
was not previously declared, then it usually represents an error,
because it means that you didn't include the header file or forgot to
put a declaration in the header file.
-- Darin
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]