delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/24/22:57:01

Date: Sun, 25 Oct 1998 03:53:45 +0000 (GMT)
From: George Foot <george DOT foot AT merton DOT oxford DOT ac DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: construction has been delayed due to somebody's stupidity (most
likely my own)
In-Reply-To: <36329321.21F4ACAD@montana.com>
Message-ID: <Pine.OSF.4.05.9810250322350.10537-100000@sable.ox.ac.uk>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019