This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

function calls before variable declarations does not give error in gcc?


Hi,

The following code does not give an error wth gcc

void fun(int a){ printf("there u go %d\n",a);}

int main()
{
        char abc[10] = "the";
        int a1 = 10;
        fun(10);
        int a = 1;
} 

gcc --version gave the following o/p:

gcc (GCC) 3.3.1 (SuSE Linux)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

while wth a compiler that gave the following o/p wth gcc --version
2.96

I got the following error:
test1.c: In function `main':
test1.c:10: parse error before `int'

why this difference?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]