How does gcc compare to other C++ compilers

M

Maxim Yegorushkin

Just a heads up: Both the Intel and Sun compilers are available for
free on Linux. They might be restricted to non-commercial use, or
something, but you can certainly try them out.

Sun C++ compiler is slow to compile and buggy, even the latest versions.
I've been using Sun compilers for 4 years and at least once per year I
encounter an instance when Sun C++ compiler generates wrong assembly
code from perfectly well-formed C++ when optimizations are enabled.
Compiling the same code with g++ and optimizations produces correct
assembly code.

Intel compilers have been know to cripple non-Intel processors. Can't
use it in a good conscience really.
http://www.agner.org/optimize/blog/read.php?i=49
 
I

Ian Collins

Have you ever tried Sun C++ compiler? I haven't seen a compiler slower
than that.

It may be slow at times, but I could compile most of sourceforge while
attempting to decipher this gem form gcc:

In file included from AclOptions.h:13,
from AclOptions.cc:15:
.../../list:1: error: expected constructor, destructor, or type
conversion before '/' token
In file included from ../../boost/exception/exception.hpp:13,
from ../../boost/exception/enable_current_exception.hpp:9,
from ../../boost/throw_exception.hpp:40,
from ../../boost/shared_ptr.hpp:31,
from ../../boost/tr1/memory.hpp:56,
from ACE.h:17,
from acl.h:15,
from ACL.h:17,
from AclOptions.h:18,
from AclOptions.cc:15:
/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/../../../../include/c++/4.3.4/typeinfo:41:
error: expected declaration before end of line
 
A

Alexei Zakharov

It may be slow at times, but I could compile most of sourceforge while
attempting to decipher this gem form gcc:

...

Sun compiler is not the champion of error messages either. I actually
found that when an error message from Sun compiler is incomprehensible
recompiling the same code with GCC makes it much easier to understand
the problem. Perhaps the reverse is true as well. I just never
considered Sun compiler a reliable fallback alternative.
 
M

Maxim Yegorushkin

Sun compiler is not the champion of error messages either. I actually
found that when an error message from Sun compiler is incomprehensible
recompiling the same code with GCC makes it much easier to understand
the problem. Perhaps the reverse is true as well. I just never
considered Sun compiler a reliable fallback alternative.

clang diagnostic is looking good: http://clang.llvm.org/diagnostics.html
 
I

Ian Collins

It may be slow at times, but I could compile most of sourceforge while
attempting to decipher this gem form gcc:

In file included from AclOptions.h:13,
from AclOptions.cc:15:
../../list:1: error: expected constructor, destructor, or type
conversion before '/' token
In file included from ../../boost/exception/exception.hpp:13,
from ../../boost/exception/enable_current_exception.hpp:9,
from ../../boost/throw_exception.hpp:40,
from ../../boost/shared_ptr.hpp:31,
from ../../boost/tr1/memory.hpp:56,
from ACE.h:17,
from acl.h:15,
from ACL.h:17,
from AclOptions.h:18,
from AclOptions.cc:15:
/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/../../../../include/c++/4.3.4/typeinfo:41:
error: expected declaration before end of line
I distilled the code that gave that bizarre error down to this:

#include <list>
#include <tr1/memory.hpp>

namespace
{
struct Option {};

typedef std::tr1::shared_ptr<Option> OptionPtr;

typedef std::list<OptionPtr> OptionList;
}

Can anyone see why it gives this error?

In file included from /tmp/x.cc:1:
.../../list:1: error: expected constructor, destructor, or type
conversion before '/' token
/tmp/x.cc:10: error: expected initializer before '<' token
 
A

Alf P. Steinbach /Usenet

* Ian Collins, on 04.08.2010 21:48:
I distilled the code that gave that bizarre error down to this:

#include <list>
#include <tr1/memory.hpp>

namespace
{
struct Option {};

typedef std::tr1::shared_ptr<Option> OptionPtr;

typedef std::list<OptionPtr> OptionList;
}

Can anyone see why it gives this error?

In file included from /tmp/x.cc:1:
../../list:1: error: expected constructor, destructor, or type
conversion before '/' token
/tmp/x.cc:10: error: expected initializer before '<' token


<code>
#include <list>
#include <tr1/memory>

namespace
{
struct Option {};

typedef std::tr1::shared_ptr<Option> OptionPtr;

typedef std::list<OptionPtr> OptionList;
}
</code>


Cheers & hth.,

- Alf
 
I

Ian Collins

* Ian Collins, on 04.08.2010 21:48:


<code>
#include <list>
#include <tr1/memory>

namespace
{
struct Option {};

typedef std::tr1::shared_ptr<Option> OptionPtr;

typedef std::list<OptionPtr> OptionList;
}
</code>

Ah, clashing with my local copy of boost.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,145
Messages
2,570,826
Members
47,372
Latest member
LucretiaFo

Latest Threads

Top