473,395 Members | 1,692 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Global variables not getting initialised in vac 8 xlC compiler

cat mystring.cpp
#include <iostream>
#include <string>
using namespace std;
string mystring ("ABC");

int main()
{
cout <<"value of string is "<<mystring<<endl;
}

The above program when compiled using the vac 8 xlC ,c++ compiler does
not seem to initialise the global variable mystring. any clues on
whats happening? should some flags be included

$ xlC -o mystring mystring.cpp /usr/lib/libC.a
$ ./mystring
value of string is
$

The same program when compiled on a vac 7 xlC compiler works fine!
$xlC -o mystring mystring.cpp /usr/lib/libC.a
$ ./mystring
value of string is ABC
$

Mar 26 '07 #1
1 1451
mu****************@gmail.com wrote:
cat mystring.cpp
#include <iostream>
#include <string>
using namespace std;
string mystring ("ABC");

int main()
{
cout <<"value of string is "<<mystring<<endl;
}

The above program when compiled using the vac 8 xlC ,c++ compiler does
not seem to initialise the global variable mystring. any clues on
whats happening? should some flags be included
We cannot help you with flags. They are compiler-specific and are not
part of C++ language definition.
>
$ xlC -o mystring mystring.cpp /usr/lib/libC.a
$ ./mystring
value of string is
$

The same program when compiled on a vac 7 xlC compiler works fine!
$xlC -o mystring mystring.cpp /usr/lib/libC.a
$ ./mystring
value of string is ABC
$
It sounds like a very serious defect in the compiler. You should
contact the technical support right away.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Mar 26 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tim | last post by:
Please advise if you can. Presumably initialisation of members in member initialisation lists is perfomed by 'C' run-time startup. If the CRT was never started-up would those members be garbage?...
2
by: Thomas Matthews | last post by:
Hi, I'm getting linking errors when I declare a variable in the global scope, but not inside a function. The declarations are the same (only the names have been changed...). class Book {...
5
by: publictom | last post by:
I just happened to read item 47, "Control Flow", in Exceptional C++ by Herb Sutter (which is based on Guru of the Week 12), just after reading item 33, "Use Inlining Judiciously", in Effective C++...
1
by: Rajesh | last post by:
Hi I am using VC 6.0 on Win2k I have multiple win32 static libs... each of the lib has global variables and in the constructor of these variables i have registeration code. This registeration...
7
by: S. A. Hussain | last post by:
Where Global variables created in STACK or HEAP in C/C++? ve##tolimitsyahoocom, delete ##
3
by: Rahul Gandhi | last post by:
Hi, Which one preferable with respect to code size of the executable Un-initialised global variables or initialised global variables regards Rahul
3
by: Felix Kater | last post by:
Some basic questions about variable initialization: a. Is it legal to initialize the variables i, b and l like this (see below) ? b. If so: At what time are they initialized? In other words:...
43
by: Kislay | last post by:
Which of the following is correct regarding the storage of global variables : 1. Global variables exist in a memory area that exists from before the first reference in a program until after the...
5
by: kiryazev | last post by:
Hello. Given the code below does C++ Standard guarantee that the function my_init() will be called before main()? struct A { A() { my_init(); } };
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.