Live data from Hacker News

GCC starts move towards implementation in C++

article.gmane.org

31–37 of 37 posts

Re: GCC starts move towards implementation in C++

#31
post #29
post #26

Earlier quoted context omitted.

I think Go might become a viable alternative to C for systems programming.

I think that one of the requirements that makes Go unsuitable as a C replacement in this specific case is the presence of the garbage collector. We need a language that we could use to write the garbage collector itself. It has to be a non-GC'd language or at least allow you to use it without linking to the GC.

I can see that being a problem if you were writing a garbage collector, but that's not a problem in this particular case (a C/C++ compiler).

Re: GCC starts move towards implementation in C++

#32
post #13

I find this statement particularly interesting: For example, I think constructors and destructors are pretty easy and hard to misuse. Now, I am aware that the competence of the average GCC committer probably exceeds that of the average programmer, but still, constructors and destructors are easy to misuse: throwing an exception in the constructor comes to mind, in which case the destructor isn't called. Anything abou…

Interesting indeed. It's good that GCC people start eating their own dog food and allow the use of C++. I'm sure this move will bring improvements to g++.

And if they have any issues, they could start compiling GCC with LLVM. I hear Clang's implementation of C++ is pretty fast, and it could help track down bugs in both suites.

That is, assuming that GCC doesn't use a ton of GCC-specific extensions, which I'm fairly certain they do.

Re: GCC starts move towards implementation in C++

#33
post #9

This could be really great for GCC if they pick the right subset. For instance, I could imagine that a GCC that takes advantage of namespaces, overloaded functions, and template functions (notably: not classes, exceptions, or implicit type coersion) to be quite a lot easier to understand than today's deeply preprocessor-dependent GCC. It's easy to assume that C++ implies OO, but you really don't need to go that way,…

I've heard anecdotal reports from a few developers that OS X's IOKit driver framework, and its limited subset of C++, works very well. It's very limited in terms of the language features available, and sounds like it strikes a good balance.

Of course, this is all anecdotal. YMMV.

Re: GCC starts move towards implementation in C++

#34
post #22
post #6

Yes, they just allowed it. They're not going to rewrite gcc in C++. But still, why, oh why? Eventhough C++ allows, in some cases, the possibility to use easier syntax for certain constructs, it's not particularly more expressive language than C. I don't know gcc codebase but if they decided to actually reimplement something in C++, it would take a lot of time just to make it comparable to the current C implementation…

Using C++ doesn't require throwing out almost a quarter decade's worth of code.

Perhaps you mean a quarter century?

Re: GCC starts move towards implementation in C++

#35
post #12
post #6

Yes, they just allowed it. They're not going to rewrite gcc in C++. But still, why, oh why? Eventhough C++ allows, in some cases, the possibility to use easier syntax for certain constructs, it's not particularly more expressive language than C. I don't know gcc codebase but if they decided to actually reimplement something in C++, it would take a lot of time just to make it comparable to the current C implementation…

...because large-scale C projects end up reinventing C++ features in a more complicated, error-prone way. C++ is much more expressive than C. It can compete on equal terms with other high-level OO languages, it has some functional features and it contains all of C. On the downside, it's difficult to learn and takes much time to become proficient in. Once you become proficient there's no contest.

It takes some overhead to implement the most essential C++ stuff in a C project. After that, the expressibility of these two languages effectively converge. That is, the will be differing factors but those factors won't be an order-of-magnitude different.

Hence, it would make sense to start with C++ in the first place, if only possible, because you will immediately save some months of C coding. However, on any large project the overhead becomes negligible. For example, gcc already has the C codebase written for decades.

The new allowed development language ought to offer not only more power but a lot more power.

Post reply on HN