D
dragoncoder
Hello all,
I am working on Solaris 9 with gcc 3.2.3. Please consider the following
code.
// a3.cxx
#include <iostream>
using namespace std;
int main() {
const char str[] = "abc";
cout << str << endl;
return 0;
}
bash-2.05$ g++ a3.cxx -ansi -Wall -pedantic
/usr/local/include/c++/3.2.3/bits/stl_threads.h: In instantiation of
`__gthread_mutex_t std::_Swap_lock_struct<0>::_S_swap_lock':
/usr/local/include/c++/3.2.3/bits/stl_threads.h:122: instantiated
from here
/usr/local/include/c++/3.2.3/bits/stl_threads.h:115: warning: aggregate
has a
partly bracketed initializer
Can someone please explain me why is the warning coming? I read the
type of a string literal in C++ is const char[], if yes, I don't expect
any warning.
Please help.
Pankaj
I am working on Solaris 9 with gcc 3.2.3. Please consider the following
code.
// a3.cxx
#include <iostream>
using namespace std;
int main() {
const char str[] = "abc";
cout << str << endl;
return 0;
}
bash-2.05$ g++ a3.cxx -ansi -Wall -pedantic
/usr/local/include/c++/3.2.3/bits/stl_threads.h: In instantiation of
`__gthread_mutex_t std::_Swap_lock_struct<0>::_S_swap_lock':
/usr/local/include/c++/3.2.3/bits/stl_threads.h:122: instantiated
from here
/usr/local/include/c++/3.2.3/bits/stl_threads.h:115: warning: aggregate
has a
partly bracketed initializer
Can someone please explain me why is the warning coming? I read the
type of a string literal in C++ is const char[], if yes, I don't expect
any warning.
Please help.
Pankaj