[EMAIL PROTECTED] wrote: > 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 >
Please don't multi-post. Here's my reply to your post in gnu.gcc.help: Well, are you talking about 'C' or 'C++'? You say 'C', but 'g++' is a C++ compiler, and files with '.cc' extension are usually C++ files. 'gcc' is the 'C' compiler. Without a complete source code example that demonstrates the problem, it is hard for anyone to say what you might be doing wrong. Regards, Larry -- Anti-spam address, change each 'X' to '.' to reply directly. _______________________________________________ Help-gplusplus mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-gplusplus
