Re: [4.4] Strange performance regression?
Joern Rennecke wrote: > But at any rate, the subject does not agree with > the content of the original post. When we talk > about a 'regression' in a particular gcc version, > we generally mean that this version is in some > way worse than a previous version of gcc. Didn't the original poster indicate that gcc 4.3 was faster than 4.4 ? In my book that is a regression. According to my reading Francesco's message, the problem is "strange behaviour with GCC 4.4.1", after which he then states that "the same problem is not (...) with GCC 4.3.3".
bug in GCC or C++ standard ?
Hello, I've come across an oddity in C++, involving anonymous unions and const variables. Neither of the two classes below will compile using gcc 4.3.0. Is this a bug in gcc or the C++ standard itself ? class my_class_1 { union { const int x; const int y; }; my_class_1() : x(0), y(0) {} }; class my_class_2 { union { const int x; const int y; }; my_class_2() : x(0) {} }; compiler output: my_class.cpp: In constructor 'my_class_1::my_class_1()': my_class.cpp:10: error: initializations for multiple members of 'my_class_1::' my_class.cpp: In constructor 'my_class_2::my_class_2()': my_class.cpp:22: error: uninitialized member 'my_class_2y' with 'const' type 'const int'
Re: bug in GCC or C++ standard ?
On 12/11/2008, James Dennett <[EMAIL PROTECTED]> wrote: > In a union only one field can be active at one time, hence > initializing more than one makes no sense > ... > However, const items need to be initialized, hence potting two in a > union makes no sense. Conceptually there is nothing wrong with having two or more const members in a union. The compiler (or standard) should recognise this particular case, and interpret that initialising one member of a union is equivalent to initialising all the members, be they const or not. > (The standard doesn't need an explicit rule to say that, as it's > implied by other rules.) I'm not sure I agree with the standard. The two requirements, i.e. (i) need to initialise all consts, and (ii) only one member of a union can be initialised, are at conflict with each other. Requirement (ii) fullfills requirement (i), so the compiler shouldn't be complaining about uninitialised consts.
Re: bug in GCC or C++ standard ?
On 12/11/2008, René Bürgel <[EMAIL PROTECTED]> wrote: > If all members of the union are const, why don't you just make the union > itself const? The const for the union seems to be ignored (code below). The original reason behind the union shenanigans was to provide a compile-time alias to another variable of the same type (due to fusion of two large legacy code bases into one). It is of course possible to provide an alias in the form of const int&, however I tried to avoid the storage penalty. struct my_class_3 { const union { int x; int y; }; my_class_3() : x(0) {} }; int main(int argc, char** argv) { my_class_3 abc; abc.y = 5; std::cout << abc.x << std::endl; return 0; } output: 5
c++ template conformance: gcc vs MS
Hello, I've come across a possible issue with GCC's adherence to the C++ standard for handling template code (gcc version 4.3.2 20081105 from Fedora 10). The following code compiles fine under GCC (using -pedantic and -std=c++98), but fails under Microsoft's C++ 2008 SP1. Microsoft explains this on http://msdn.microsoft.com/en-us/library/cx7k7hcf(VS.80).aspx Is GCC or Microsoft at fault ? Code (from a header file): template struct get_num_type { typedef T1 num_type; }; template<> // this line causes the problem template struct get_num_type< std::complex > { typedef T2 num_type; }; MS compilers gives: error C2910: 'arma::get_pod_type>' : cannot be explicitly specialized
Re: c++ template conformance: gcc vs MS
[Sorry, I pasted the wrong compiler output (but for the same bug). Below is the corrected e-mail. ] I've come across a possible issue with GCC's adherence to the C++ standard for handling template code (gcc version 4.3.2 20081105 from Fedora 10). The following code compiles fine under GCC (using -pedantic and -std=c++98), but fails under Microsoft's C++ 2008 SP1. Microsoft explains this on http://msdn.microsoft.com/en-us/library/cx7k7hcf(VS.80).aspx Is GCC or Microsoft at fault ? Code (from a header file): template struct get_num_type { typedef T1 num_type; }; template<> // this line causes the problem template struct get_num_type< std::complex > { typedef T2 num_type; }; MS compilers gives: error C2910: 'get_num_type>' : cannot be explicitly specialized
Re: c++ template conformance: gcc vs MS
2009/5/28 Andrew Pinski: > > GCC see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24314 . > hmm.. known since 2005. Is there some difficulty in fixing this ?