Sigh. It's been awhile since I've programmed in C, but I'm SURE that
you can have a function whose scope is purely within another function.
Yet here I have a program which compiles without a peep under gcc4.2.1
(with -ansi -Wall, no less), AND runs correctly, but which icc
(10.1.015) won't touch with a ten-foot-pole:
=====begin sample program=====
#include <stdio.h>
int main()
{
int sub1()
{
printf("1");
return(0);
}
int sub2()
{
printf("2\n");
return(0);
}
/* start of main */
sub1();
sub2();
}
=======end sample program========
I don't see anything wrong with this. Nevertheless, icc aborts the
compilation with the fatal error
testit.c(6): error: expected a ";"
{
^
It doesn't like the opening left-brace of "sub1".
Now, I've read this group before, and I know I'm going to get reamed
for such a simple question, but: what's wrong? And why does one
compiler pass it and the other doesn't?
This is in openSuse 10.3 on a 2.5GHz core 2 duo with 3GB RAM (though
none of that matters).
Thanks in advance,
--
Ron Bruck
you can have a function whose scope is purely within another function.
Yet here I have a program which compiles without a peep under gcc4.2.1
(with -ansi -Wall, no less), AND runs correctly, but which icc
(10.1.015) won't touch with a ten-foot-pole:
=====begin sample program=====
#include <stdio.h>
int main()
{
int sub1()
{
printf("1");
return(0);
}
int sub2()
{
printf("2\n");
return(0);
}
/* start of main */
sub1();
sub2();
}
=======end sample program========
I don't see anything wrong with this. Nevertheless, icc aborts the
compilation with the fatal error
testit.c(6): error: expected a ";"
{
^
It doesn't like the opening left-brace of "sub1".
Now, I've read this group before, and I know I'm going to get reamed
for such a simple question, but: what's wrong? And why does one
compiler pass it and the other doesn't?
This is in openSuse 10.3 on a 2.5GHz core 2 duo with 3GB RAM (though
none of that matters).
Thanks in advance,
--
Ron Bruck
Comment