Mail Archives: djgpp/1998/10/24/22:57:01
On Sat, 24 Oct 1998, bowman wrote:
> It is interesting that one can declare a function returning MyClass,
> never define or
> use it, and the compiler never says a word, while it will emit warnings
> for used
> variables.
I know little C++, but in C external-scope functions aren't
warned about, because the compiler can't know that they're not
called from another file. If you make them static and use the
appropriate warning options ("-Wall -O" does it I think) then it
will warn you about this. Same for static variables, but not
externs. You referred above to automatic variables, I think.
-Wstrict-prototypes, -Wmissing-prototypes and
-Wmissing-declarations can be useful too it you like that sort
of thing (I do in non-trivial programs). The latter two in
particular notify you when you forgot to declare a
(external-scope) function or variable in a header file.
--
george DOT foot AT merton DOT oxford DOT ac DOT uk
xu do tavla fo la lojban -- http://xiron.pc.helsinki.fi/lojban/lojban.html
- Raw text -