|
|
Subscribe / Log in / New account

GCC begins move to C++

GCC begins move to C++

Posted May 31, 2010 23:17 UTC (Mon) by HelloWorld (guest, #56129)
In reply to: GCC begins move to C++ by Lovechild
Parent article: GCC begins move to C++

I was going to write that someone has written a long rebuttal to that email, but then I realised that there isn't really a lot to rebut, given that Torvalds hardly makes any real points at all. Anyway, here's what it reminded me of:
http://warp.povusers.org/OpenLetters/ResponseToTorvalds.html


to post comments

GCC begins move to C++

Posted Jun 1, 2010 3:27 UTC (Tue) by jrn (subscriber, #64214) [Link] (5 responses)

I don’t think Linus’s messages were meant to do much more than explain why core Git should stay in C, so the rebuttal seems a bit misdirected. But I could not resist mentioning a different problem: the mistake of not taking into account differences in idiom, which seems to be well described here: http://www2.research.att.com/~bs/bs_faq.html#compare

One of the merits of idiomatic C is that it is easy to guess roughly what is going to happen on the machine due to your code. I cannot imagine an experienced C programmer using

for (i = 0; i < strlen(line); i++)

except to prove a point, for exactly this reason.

Especially amusing was this:

> Unless countless very respected computer scientists and programmers around the world are completely wrong, we just cannot deny that non-abstract, low-level code tends to be quite unmaintainable. This is the more true the larger the program is.

> Torvalds not only admits here that C, by its very nature, leads you to create non-abstract, low-level code, that C gives you the mentality required to create such non-abstract code, but he actually claims that it's a good thing that this is so.

How does one explain the Linux kernel? Of course it includes abstraction where appropriate, just like most reasonably-sized C programs do.

GCC begins move to C++

Posted Jun 2, 2010 18:35 UTC (Wed) by Cyberax (✭ supporter ✭, #52523) [Link] (4 responses)

"I cannot imagine an experienced C programmer using
for (i = 0; i < strlen(line); i++)
except to prove a point, for exactly this reason."

Nope, it's a great example. Because C programmers routinely use examples which no sane C++ developer will ever write to prove that C++ is BAD BAD BAD. Why shouldn't C++ developers do the same?

"How does one explain the Linux kernel? Of course it includes abstraction where appropriate, just like most reasonably-sized C programs do."

Linux is good because it's not actually quite that big. Most of code is in the drivers. And its infrastructure code if fairly compact and has quite clean abstractions.

GCC begins move to C++

Posted Jun 2, 2010 18:45 UTC (Wed) by ikm (guest, #493) [Link] (1 responses)

> Why shouldn't C++ developers do the same?

Maybe because they don't have a problem with C?

GCC begins move to C++

Posted Jun 2, 2010 18:47 UTC (Wed) by Cyberax (✭ supporter ✭, #52523) [Link]

That's a good point :)

GCC begins move to C++

Posted Jun 4, 2010 9:53 UTC (Fri) by jrn (subscriber, #64214) [Link] (1 responses)

> Because C programmers routinely use examples which no sane C++ developer will ever write to prove that C++ is BAD BAD BAD.

Good point. I get annoyed when C programmers do it, too. :)

GCC begins move to C++

Posted Jun 4, 2010 10:06 UTC (Fri) by dlang (guest, #313) [Link]

the problem is that there are so many insane developers around (in every language, I'm not picking on C++ here :)

GCC begins move to C++

Posted Jun 1, 2010 3:54 UTC (Tue) by jamesh (guest, #1159) [Link] (1 responses)

Whether you agree with Linus's opinion on C++, there is a pretty big difference between the gcc and git situations.

For git, a minor contributor was proposing changes that would negatively affect the core developers' ability to maintain the code base (since C++ is not one of their areas of expertise). In the gcc case, it is the core developers themselves who are suggesting the change and believe it will make maintenance easier.

GCC begins move to C++

Posted Jun 1, 2010 6:30 UTC (Tue) by adobriyan (subscriber, #30858) [Link]

> For git, a minor contributor was proposing changes

Proposing? I don't think so.

> When I first looked at Git source code two things struck me as odd:
> 1. Pure C as opposed to C++. No idea why. Please don't talk about
> portability, it's BS.
> 2. Brute-force, direct string manipulation. It's both verbose and
> error-prone. This makes it hard to follow high-level code logic.

GCC begins move to C++

Posted Jun 1, 2010 9:08 UTC (Tue) by ctg (guest, #3459) [Link] (1 responses)

Linus seems to be saying two things:

1) Real Programmers use C
2) C++ is about architecture, as much as code, and the architecture tends to be rigid. With C, you can ignore/change/adapt architectures within a project/timeframe.

While I have some sympathy with the statements, I think it is largely a question of taste.

GCC begins move to C++

Posted Jun 1, 2010 9:22 UTC (Tue) by ikm (guest, #493) [Link]

C++ allows creating high-level abstractions, something that C doesn't really allow. The problem with abstractions, of course, is that programmers aren't required to understand their underlying complexities. However, just because the complexity is abstracted away from the programmer, it doesn't go anywhere -- it is just being ignored by the programmer. Therefore C++ programmers tend to create less efficient code than C ones.

Note the word 'tend'. This problem is not with the language, but with the monkey coders. How many C++ programmers actually understand how virtual functions are implemented, for instance?

With GCC, the answer would actually be "all of them" :)

The Linus' solution is just not to use C++ and do all the dirty work the compiler would've done for you yourself. I like the GCC's one -- to limit the allowed subset and to be careful and thoughtful -- MUCH better.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds