help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

g++ and Static Variables


From: fewgoodmen
Subject: g++ and Static Variables
Date: 2 May 2005 06:55:24 -0700
User-agent: G2/0.2

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]