We are nesting functions now?

kwall@kurtwerks.com kwall@kurtwerks.com
Wed Dec 11 21:33:00 GMT 2002


Feigning erudition, Matt Young wrote:
% /* This seems to work */
% int  main() {
%         void fi() {
%                 void f2() {
%                         printf("F2\n");
%                         }
%                 void f3() {
%                         printf("F3\n");
%                         f2();
%                         }
%                 printf("F1\n");
%                 }
%         fi();
%         f3();
%         return 1;
% }

Please define "seems to work". After #including stdio.h,

[~/src]$ cc -Wall nest.c
nest.c: In function `main':
nest.c:15: warning: implicit declaration of function `f3'
/tmp/cc4UlMpa.o: In function `main':
/tmp/cc4UlMpa.o(.text+0x82): undefined reference to `f3'
collect2: ld returned 1 exit status
[~/src]$ gcc -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2/specs
Configured with: ../gcc-3.2/configure --enable-threads --enable-shared --enable-static --disable-nls --enable-languages=c,c++,g77,objective-c
Thread model: posix
gcc version 3.2

Kurt
-- 
Steinbach's Guideline for Systems Programming:
	Never test for an error condition you don't know how to
handle.



More information about the Gcc mailing list