delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/07/09/12:15:21

From: Thomas8675309 AT yahoo DOT com (Tom)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: nested functions
Date: 9 Jul 2003 09:00:26 -0700
Organization: http://groups.google.com/
Lines: 34
Message-ID: <7b68d58f.0307090800.63f33522@posting.google.com>
References: <26365 DOT 1057693929 AT www22 DOT gmx DOT net> <begar5$bf6$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>
NNTP-Posting-Host: 63.72.148.162
X-Trace: posting.google.com 1057766427 26532 127.0.0.1 (9 Jul 2003 16:00:27 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: 9 Jul 2003 16:00:27 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hans-Bernhard Broeker wrote:

> ahelm AT gmx DOT net wrote:
> 
> > Could somebody enlighten me whether nested functions are a GCC or DJGPP
> > extension or whether they are actually part of the C standard.
> 
> A GCC extension, as clearly documented here:
> 
> 	info gcc "C Extensions" "Nested Functions"
> 
> Another way you can tell is that it will fail to compile if you put
> GCC into ANSI-C-only mode (gcc -ansi -pedantic for GCC 2, something
> else for GCC 3.x).

In GCC 3.x, -pedantic is what is required, but even it will only
generate a warning.  (If you really want to prevent compilation
entirely, you need -pedantic-errors).  Oddly, -ansi does not diable
the nested function extension, because it only disables extensions
that are "incompatible" with ISO C90.

For most beginners, and for me as well, turning on all, or almost all,
warnings is usually best.  This pretty much does it:

-Wall -W -pedantic

For reasons I don't understand, -W turns on warnings that -Wall does
not.  I believe there is a proposal (perhaps it was already adopted)
to change the name of -W to something that more clearly expresses what
that compiler option does.

Best regards,

Tom

- Raw text -


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