This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: We are nesting functions now?
- From: "Kris Warkentin" <kewarken at qnx dot com>
- To: <kwall at kurtwerks dot com>, "Timothy J. Wood" <tjw at omnigroup dot com>
- Cc: "GCC List" <gcc at gnu dot org>
- Date: Thu, 12 Dec 2002 08:57:54 -0500
- Subject: Re: We are nesting functions now?
- References: <FCAC6848-0D96-11D7-A508-0003933F3BC2@omnigroup.com>
It's a gcc extension. Probably in there for Pascal support.
http://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Nested-Functions.html#Nested%20Fun
ctions
cheers,
Kris
----- Original Message -----
From: "Timothy J. Wood" <tjw@omnigroup.com>
To: <kwall@kurtwerks.com>
Cc: "GCC List" <gcc@gnu.org>
Sent: Thursday, December 12, 2002 1:00 AM
Subject: Re: We are nesting functions now?
>
>
> If you move the call to f3 so that it is in the proper scope, this
> works:
>
> % cc -Wall foo.c -o foo
> % ./foo
> F1
> F3
> F2
> % cc -v
> cc -v
> Reading specs from /usr/libexec/gcc/darwin/ppc/3.1/specs
> Thread model: posix
> Apple Computer, Inc. GCC version 1173, based on gcc version 3.1
> 20020420 (prerelease)
>
>
> #include <stdio.h>
> int main() {
> void fi() {
> void f2() {
> printf("F2\n");
> }
> void f3() {
> printf("F3\n");
> f2();
> }
> printf("F1\n");
> f3();
> }
> fi();
> return 1;
> }
>
> -tim
>
>