Slashdot Mirror


Standard C++ Moves Beyond Vapor

An Anonymous Coward++ writes "This google thread announces the first C++ compiler that can actually handle the whole language (we'd been waiting for half a decade here). The company that did it is EDG. They're a tiny outfit, but they're apparently also behind the Intel compiler (both on Windows with Visual C++ extensions, and on Linux with GCC extensions). There are rumors they can compile the Linux kernel too."

27 of 385 comments (clear)

  1. GCC code is slow as molasses by October_30th · · Score: 2, Informative
    GCC code is slow.

    I code computationally intensive number crunching code and I had to buy Intel's compiler for Intel and Compaq's compiler for Alpha just to get some performance. And I'm talking about 10-20% difference.

    --
    The owls are not what they seem
    1. Re:GCC code is slow as molasses by Unknown+Lamer · · Score: 4, Informative

      GCC code is slow.

      I code computationally intensive number crunching code and I had to buy Intel's compiler for Intel and Compaq's compiler for Alpha just to get some performance. And I'm talking about 10-20% difference.

      Then you should like GCC 3.1. Here is a snippet from the changelog (you can see the entire list of changes at http://gcc.gnu.org/gcc-3.1/changes.html):

      • According to the SPECInt2000 results on an AMD Athlon CPU, the code generated by GCC 3.1 is 6% faster on the average (8.2% faster with profile feedback) compared to GCC 3.0. The code produced by GCC 3.0 is about 2.1% faster compared to 2.95.3. Tests were done using the -O2 -march=athlon command-line options.
      • The compiler now supports MMX, 3DNow!, SSE, and SSE2 instructions. Options -mmmx, -m3dnow, -msse, and -msse2 will enable the respective instruction sets. Intel C++ compatible MMX/3DNow!/SSE intrics are implemented. SSE2 intrics will be added in next major release.
      • Following those improvements, targets for Pentium MMX, K6-2, K6-3, Pentium III, Pentium 4, and Athlon 4 Mobile/XP/MP were added. Refer to the documentation on -march= and -mcpu= options for details.
      • For those targets that support it, -mfpmath=sse will cause the compiler to generate SSE/SSE2 instructions for floating point math instead of x87 instructions. Usually, this will lead to quicker code -- especially on the Pentium 4. Note that only scalar floating point instructions are used and GCC does not exploit SIMD features yet.
      • Prefetch support has been added to the Pentium III, Pentium 4, K6-2, K6-3, and Athlon series.
      • Code generated for floating point to integer converisons has been improved leading to better performance of many 3D applications.
      There is also AltiVec support for the PowerPC now. You can also trying using -fprofile-arcs, run your program once, then recompile with -fbranch-probabilities to help GCC predict branches (but then again if all your code does is crunch large numbers, there might not be too many branches in the first place).
      --

      HAL 7000, fewer features than the HAL 9000, but just as homicidal!
    2. Re:GCC code is slow as molasses by Matthew+Austern · · Score: 2, Informative

      Guiding declarations are an obsolete and rather arcane feature that was present in some early versions of pre-standard C++ but that aren't part of the C++ standard. For the most part they're only of historical interest. (Assuming you're interested in the history of such things, that is.)

      If you've got legacy code that used guiding declarations and you need to know how to convert it to standard C++, there's a nice discussion in the kcc documentation.

  2. Re:GCC is missing stuff? by norwoodites · · Score: 5, Informative

    gcc is missing export and some other stuff see http://gcc.gnu.org/bugs.html for more examples of what is missing, scroll down.

  3. Re:GCC is missing stuff? by RealityThreek · · Score: 5, Informative

    Go buy the newest version of Bjarne Strostrup's book, and try out his example programs in the majority of C++ compilers.

    You'd be amazed at how much has been missing. Mainly the STL stuff, but there's some bugs in templating in some compilers too.

    It sucks when you try to write portable code in C++ and you end up not being able to use some cool stuff because not all compilers support it. A friend of mine switched to Java specificly because of this.

    --
    :wq
  4. Re:Compile the kernel? by BlueFall · · Score: 2, Informative

    The kernel has been pretty much tailored to gcc and many other compilers seem to have trouble with it.

  5. every c++ compiler is different by rebelcool · · Score: 3, Informative
    so far, c++ code hasnt been very portable among different compilers (even different versions of the same compiler... i've got plenty of textbook code around that compiles under the g++ 2.x series, but not g++ 3)

    They all don't properly implement different parts of the standard, which leads to all sorts of cross platform issues.

    It's about time someone has done something about it. EDG is no small name in the compiler world either..

    --

    -

    1. Re:every c++ compiler is different by randombit · · Score: 4, Informative

      My understanding of C++ is that it doesn't define things like how class data is stored, standard name-mangling, etc.

      Which, overall, is a good thing. I should note C doesn't either - the C ABIs are specified by systems people. For example, there is a System V ABI for x86, which is basically what all the Unix versions on x86 use.

      So I guess that this is a good step towards compiler compatibility, but linking will probably still be a problem.

      There is now an official IA-32 C++ ABI. Nobody has done it completely, but GCC and Intel are supposed to converge on it in the future. There has also been an IA-64 C++ ABI since the start, though AFAIK some incompatibilies still remain between different compilers (but they are working on it, I think).

    2. Re:every c++ compiler is different by Matthew+Austern · · Score: 2, Informative
      There has also been an IA-64 C++ ABI since the start

      To be a bit more specific, it's an ABI for IA-64 Unix systems that use the ELF object format.

      That's an awful lot of qualifications, but they're necessary. (And not just for C++.) Even such simple things as function calling conventions differ from platform to platform, and linkers are a lot less trivial, and involve a lot more design choices, than most people realize.

  6. From Later in the Thread by Ieshan · · Score: 5, Informative

    "The product Edison sells is basically just the front end. Someone needs
    to add a code generator, libraries, support tools, etc. to produce
    a complete compiler package. (We use the Edison front end for our
    compiler product at Concurrent, so hopefully we'll have all these
    nifty features someday - but everyone should be sure they don't
    interpret this casual comment as an official promise - I don't even
    work on the compiler :-)."

    I dont know how right this guy is, and I have no expertise in the area myself... but isn't this exactly what we're doing with this slash story? Interpretting this comment as an official promise?

  7. Re:what am I missing? by Anonymous Coward · · Score: 2, Informative

    No, partial specialization has been supported by most compilers EXCEPT for VC++ for quite a while now. That's the biggest gripe that I (and many others) have with the MS compiler. Fix that, and some of the other problems would go away as well (it would be much easier to write a decent implentation of the standard library, for one).

  8. No linux kernel compile, sorry by ZeekWatson · · Score: 2, Informative

    Uh, ze linux kernel isn't written in C++, it is written in C.

    Also, linux (kernel) uses a bunch of (proprietary to GCC :) extensions to C that no other compiler has, so this compiler hasn't a hope in hell of compiling the kernel.

    You need to realize that most low-level stuff isn't written in C++ (ie kernels, device drivers, TCP/IP stack, Apache, Perl, Python etc). C++ simply does not have the efficiency. I'm not saying C++ is slow, just that it isn't suitable for that kind of programming.

  9. Missing Features List As Of Last Year by Carnage4Life · · Score: 5, Informative
  10. Re: We need an engineer who knows the whole langua by wray · · Score: 4, Informative

    Frankly, your number pulling of "99% of software engineers" not needing the speed of C++ is just ridiculous and arbitrary. Look at the sheer number of complaints of about gnome, kde, mozilla, and related projects being to slow and you will realize that there is never enough speed. And those are just UI programs.

    I won't stoop to your pulling numbers out of the blue, but I would contend there is a great deal of scientific and research software that also need every bit of speed they can get. These programs alone must constitute way more than the 1% you have allotted. The software I am developing is in that category.

    Finally, when you speak as you have, you declare your ignorance loudly. Yes, C++ does not prevent you from making the kinds of mistakes that you refer to; but by learning good engineering techniques, you can avoid and prevent them yourself. Languages which do restrict you in this area *cough*java*cough* also restrict your creativity and power to accomplish your task. A civil engineer for example, uses techniques -- not restrictions -- to make his/her designs infallible; it is time software engineers step up to the plate and begin using solid techniques rather than blame the language.

    That being said, it is still important to use the right tools for the job, if speed is not a concern and you can acclompish the task with something safer and easier -- do it! C++, however is going to remain an important and key tool to accomplish many tasks in the future. Its speed, ability, and flexibility will assure its long life.

    --
    Guess what? I got a fever! And the only prescription.. is more cowbell!
  11. Mozilla C++ Portability Guide by Malc · · Score: 3, Informative

    You should take a look a the Mozilla C++ Portability Guide. It's quite depressing.

    1. Re:Mozilla C++ Portability Guide by Anonymous Coward · · Score: 2, Informative

      yes that IS depressing. Most of the things I do to help me keep bugs down are "dont's" and the things I dont do to keep bugs down are "do's". My favorite out of that list HAS to be #if 0. I never never never never ever use that. Why? Im lazy. It will never get put back in correctly. I would ask a better question when you use #if 0. Why in THE HELL are you checking in code that does not work? You obviously KNOW it doesn't work. Why are you checking it in? Open another file plop the code in there. Take it out of the other file and do not be so sloppy. Had one programmer that did the #if 0 'trick' quite a bit. He left the project (then the company). But we were stuck with LARGE chunks of code we were not quite sure how they hell it even compiled. Im talking 20 pages of commented out stuff. When we found those little gems we were ready to kill. If it doesn't work take it out... Extra junk laying around in a file makes a already tough job even harder!

    2. Re:Mozilla C++ Portability Guide by mce · · Score: 3, Informative

      While I agree that the state of C++ compilers could be a lot better (more power to EDG!), the Mozilla C++ Portability Guide is seriously outdated. It is by now 4 years old, and it shows. The claims about the HP compiler, for instance, apply to the previous compiler. No, not just the previous version, the previous compiler, for which HP has discontinued all support some time ago already. Actually, even back in April 98, HP's CC compiler was already being phased out and replaced by the much much better aCC one. Actually, we made the switch some time (I don't recall exactly) before the start of my current project in September of 1997.

  12. Re:GCC is missing stuff? by Matthew+Austern · · Score: 2, Informative

    Exported templates, universal character names in identifiers, and a few less important things. As of 3.1, gcc has a pretty complete standard library.

  13. Info available on EDG's website by xphase · · Score: 4, Informative
    For those who don't trust a google discussion(like me), EDG's website has info here:
    Supported C++ and C Language Features

    This page also says:

    There is also a GNU C compatibility mode, which provides the extensions supported by GCC (version 3.0.1), along with various undocumented features and bugs. The compatibility is good enough that the front end can compile the Linux kernel and utilities. At present, there is no g++ mode, i.e., no way to enable GNU extensions and C++ mode at the same time.

    --xPhase

    --
    The following sentence is TRUE. The previous sentence is FALSE.
  14. Re:Their product is only a front end by Matthew+Austern · · Score: 3, Informative
    In particular, I know that KAI C++ and Compaq's C++ compiler are both based on EGD.

    Yes, KAI and Compaq use the Edison front end. So do Comeau, SGI, Intel, and a number of other compilers. See EDG's site for a more complete list.

    Some of EDG's customers will release a compiler based on the new front end sooner than others, partly for business reasons (every company has different tradeoffs) and partly for technical reasons (for some companies, a new front end means an awful lot of integration work).

    I expect Comeau to be the first company to sell a compiler based on the new EDG front end: Greg Comeau has been very excited at being able to support export. I'll be surprised if it takes longer than a few weeks for the new Comeau compiler to come out.

  15. Re:Anyone Can Claim Standards Compliance, Prove It by _|()|\| · · Score: 5, Informative
    On the other hand passing the C/C++ User Journal's compiler roundup's set of conformance tests from Dinkumware, [et al.]

    Well, P.J. Plauger did post on the thread: "The new EDG front end passes all the tests in the Dinkum C++ Proofer." I'd say that's a pretty good start.

  16. Re:what am I missing? by Josh · · Score: 2, Informative

    The implementation of the 'export' feature for templates has been missing from most compilers. Having it enables projects to possibly compile faster and with less code bloat in the binaries. Using templates often leads to faster executables than other strategies for doing the same thing.

  17. Re: We need an engineer who knows the whole langua by Anonymous Coward · · Score: 1, Informative

    check Google, enter "The Programmers Stone". Download it, read it. Youre one of those "packers".

    Get a clue. Until then, shut up.

  18. More information: what this really means by Anonymous+Brave+Guy · · Score: 4, Informative

    <sigh>Once again my story gets rejected when it contains more info than the one that gets posted. :-(

    To set the record straight, EDG do indeed produce C++ front end compiler tools, and it is these that have just been released.

    However, major C++ vendors including Comeau Computing use that in their compilers. Comeau already have a beta of their 4.3.0 compiler available at their on-line compiler. The full version is due later this month.

    Dinkumware have also announced a version of their standard library implementation to work with Comeau, which should be available shortly after the Comeau compiler is released. Apparently, it makes extensive use of export, but for little change in performance at compile-time.

    That makes their new library implementation a bit academic as far as Joe Developer goes. However, it's excellent news in general, because it shows that using export isn't going to entail a performance hit. We can finally write template code with interface and implementation properly separated out.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  19. Re:GCC is missing stuff? by stripes · · Score: 3, Informative
    You'd be amazed at how much has been missing. Mainly the STL stuff, but there's some bugs in templating in some compilers too.

    I don't think gcc is missing any of the STL stuff anymore (or rather the includes and libg++). GCC does have trouble with some of the "new" namespace stuff, and some edge cases in the type system can do the wrong thing (however they are far enough on the edge that maybe I was wrong about them, not gcc).

    It sucks when you try to write portable code in C++ and you end up not being able to use some cool stuff because not all compilers support it. A friend of mine switched to Java specificly because of this.

    Well that is the nice thing about pushing all the complexity into the libraries (yes Java is a more complex language the C...but less then C++ or Perl). Hmmm, speaking of Perl (or even Intercal...) it is also an advantage of really only having one implementation too...

  20. This is not how GPL works by MrByte420 · · Score: 2, Informative

    >harsh restrictions of the BSD license. It also lacks >the GPLs requirement that anything coded with its >tools becomes property of the FSF. You have this totally backwards. The GPL only says that if you modify the source code of a GPL program amd redistribute it - you must make the orginal code available to the end user. What you use a GPL'd piece of software for is up to you. Furthermore GPL'd software is NOT property of FSF unless you decide to give them those rights. otherwise the copyright is held by the orginal author.

    --
    If religous zealots don't believe in Evolution, then why are they so worried about bird flu?
  21. EDG's role by Animats · · Score: 4, Informative
    As others have mentioned, Edison only does the front end. The output is an intermediate form, not object code. There aren't very many C++ parsers. GCC has one, Microsoft has one, and most of the other compilers use the EDG front end.

    It says something about how complex C++ syntax has become that this is the case. It's very hard to parse C++, because you have to do extensive declaration handling to find out what's a type name, and you have to know what's a type name just to parse. C++ is thus context-dependent.

    One major implication of that context-dependency is that you can't parse a C++ text file without processing the include files. This is why tools like "indent" are hard to find for C++. "Little" tools for C++ are rare. And that hurts the language.

    I'd like to see a cleanup of C++, but it's not going to happen. Most of the action in the C++ standards effort is going into adding obscure features for fancy templates. As a result, C# and Java are gaining market share.