Different behavior of g++ and gcc (both egcs) compilers

Alex Vinokur alexander.vinokur@telrad.co.il
Wed Jul 14 05:37:00 GMT 1999


Hi,

Here is a simple program.
Why is the g++ and gcc (both egcs) compilers' behavior different?

        Thanks in advance,
        Alex



//#########################################################
//------------------- C++ code : BEGIN -------------------
// main.C

int n = 0;
void foo (char a [n])
{                       // Line#3
}

int main()
{
        return 0;
}


//------------------- C++ code : END ----------------------

//#########################################################
//------------------- Compilation Results : BEGIN ---------

%g++ main.c
main.c:3: variable-size type declared outside of any function

%gcc main.c     // OK


//------------------- Compilation Results : END -----------

//#########################################################
//------------------- Compiler & System  ------------------

g++ -v     : gcc version egcs-2.91.57 19980901
             (egcs-1.1 release)

gcc -v     : gcc version egcs-2.91.57 19980901
             (egcs-1.1 release)

uname -a   : SunOS <nodename> 5.6 Generic_105181-09
             sun4m sparc SUNW,SPARCstation-5

//---------------------------------------------------------

//#########################################################





More information about the Gcc-bugs mailing list