F
fewgoodmen
I am currently working on changing the compiler from Sun Workshop to
g++ for a mid sized C program. In the C files we have static variables
defined and declared. This works fine with the Sun Workshop compiler.
However under g++ the static variables are initialized to zero but do
not have the value they are assigned to. For example say file2.cc I
have static variable defined and declared as
static int j = 5;
Variable j seems to have a value of zero and not 5. However any static
variables defined and declared in the file that contains function main
seems to have the value that is assigned to them. I am using g++
version 3.2.2 in a Solaris 8 environment.
Any help would be appreciated.
Joe
g++ for a mid sized C program. In the C files we have static variables
defined and declared. This works fine with the Sun Workshop compiler.
However under g++ the static variables are initialized to zero but do
not have the value they are assigned to. For example say file2.cc I
have static variable defined and declared as
static int j = 5;
Variable j seems to have a value of zero and not 5. However any static
variables defined and declared in the file that contains function main
seems to have the value that is assigned to them. I am using g++
version 3.2.2 in a Solaris 8 environment.
Any help would be appreciated.
Joe