Slashdot Mirror


GCC Moving To Use C++ Instead of C

An anonymous reader writes "CodeSourcery's Mark Mitchell wrote to the GCC mailing list yesterday reporting that 'the GCC Steering Committee and the FSF have approved the use of C++ in GCC itself. Of course, there's no reason for us to use C++ features just because we can. The goal is a better compiler for users, not a C++ code base for its own sake.' Still undecided is what subset of C++ to use, as many contributors are experts in C, but novices in C++; there is a call for a volunteer to develop the C++ coding standards."

8 of 546 comments (clear)

  1. Incorrect headline by Letharion · · Score: 5, Informative

    The headline says "Use C++ instead of C" which is incorrect. C++ is, as made obvious from the text, an option, not a requirement.

  2. Re:The devs don't know C++?? Its a C++ compiler! by chocapix · · Score: 5, Informative

    I think you're confused. Strictly speaking, GCC isn't even a C compiler.

    GCC stands for "GNU Compiler Collection". In that collection, there's a C compiler as well as a C++ compiler, a Java compiler, and many more (they are not completely separate, they actually share a lot of code between them). All of them are written in C, and the news here is they're going to be written in C++ in the near future.

  3. Re:From the article it is obvious by Cyberax · · Score: 4, Informative

    Because ObjectiveC is a slow shit?

    Seriously, it might be OK for designing GUI interfaces, its dynamic nature helps there. But for compiler writing I'd prefer something:
    1) Fast.
    2) Typed.
    3) Deterministic (no non-deterministic GC).

  4. Re:thus a disaster by MadKeithV · · Score: 5, Informative

    You'll see exceptions, then memory leaks, an attempt to solve it with some kind of braindead "smart" pointer, somebody needs multiple inheritance, some ass overloads the comma operator or () operator, overloading gets sort of ambiguous with differences between the 32-bit and 64-bit builds, Boost gets pulled in with compile times and start-up times going to Hell, people cry for Java-style garbage collection...

    If the first thing you get from C++, coming from C, is exceptions, then you're going to be in a world of pain. Most people who started with C++ have trouble with it. For a quick indication why, see Code Complexity @ GOTW.ca .

    As a 10-year veteran of C++, I say to start with RAII, and since you're going OO, require everyone involved to learn the SOLID principles.

  5. Re:Seems odd... by mog007 · · Score: 4, Informative

    At best, the compiler would date back to Grace Hopper, as she was the person who invented the compiler. I believe it was for Fortran.

  6. Re:Seems odd... by Per+Wigren · · Score: 5, Informative

    It was Flow-Matic aka B-0 which later kind of evolved into COBOL, also designed by her.

    --
    My other account has a 3-digit UID.
  7. Re:Maybe they've grown up a bit by ommerson · · Score: 5, Informative

    Quite simply because STL is the embodiment of several decades of algorithms and data structures research work. In many cases, use of STL results in near optimal code. In raw C, you're left to yourself to write your own collections and algorithms. You have to try pretty hard to surpass the performance of STL. Do you want compiler developers to constantly reinventing wheels or actually improving the compiler?

  8. Re:What... by MikeBabcock · · Score: 4, Informative

    Or even from the GCC build instructions:

    For a native build, the default configuration is to perform a 3-stage bootstrap of the compiler when `make' is invoked. This will build the entire GCC system and ensure that it compiles itself correctly. It can be disabled with the --disable-bootstrap parameter to `configure', but bootstrapping is suggested because the compiler will be tested more completely and could also have better performance.

    The bootstrapping process will complete the following steps:

         

    • Build tools necessary to build the compiler.
           
    • Perform a 3-stage bootstrap of the compiler. This includes building three times the target tools for use by the compiler such as binutils (bfd, binutils, gas, gprof, ld, and opcodes) if they have been individually linked or moved into the top level GCC source tree before configuring.
           
    • Perform a comparison test of the stage2 and stage3 compilers.
           
    • Build runtime libraries using the stage3 compiler from the previous step.
           
    --
    - Michael T. Babcock (Yes, I blog)