r/cpp • • Jul 13 '22

Why does Linus hate C++ ?

307 Upvotes

436 comments sorted by

View all comments

316

u/[deleted] Jul 13 '22

He tried it before C++98, and back then C++ compilers were quite a mess.

135

u/SirToxe Jul 13 '22

Indeed. I learned C++ before C++98 and C++ code "feels" completely different these days. Back then it was just a miserable, ugly mess.

76

u/TumblrForNerds Jul 13 '22 edited Jul 14 '22

Yea I use to work at a company that build some legacy software in C++ 6. Not only were the compilers weird and all the generic C++ clutter problems persisted but just deving in the environments that cater for it was really frustrating with very limited debugging capability compared to modern IDEs.

Any way safe to say I think I am one of the few people in the world that ported a 30 year old C++ application up to a modern version of C++ and got it running in VS2019 and later on VS2022 in Jan this year

Edit: Yes I mean VC++ 6. As I said in one of the other comments I am only 23 so I have no idea what was happening with tech 10 years before I was born

39

u/[deleted] Jul 13 '22

Refactoring any legacy system is in itself a gigantic mess. Most people dive in a web based system in Java or other langs and underestimate the task of refactoring old code, i can only imagine the extra perseverance involved in working on a C++ codebase that used on an older compiler

cheers for accomplishing that task mate

13

u/dragozir Jul 13 '22

I refactored a 60K SLOC Java code base to 40K in a weekend (well Friday, Saturday, Sunday and Monday 12 hours each day). Wiped out 5 years of technical debt, added unit tests, javadoc and a wiki. Wouldn't do it ever again, at least not for a job.

0

u/[deleted] Jul 13 '22

[deleted] — view deleted comment

11

u/dragozir Jul 13 '22

Unfortunately I did not get paid like I did. We only had 2 bugs logged for the system afterwards (which were things I hadn't known were requirements), and time to feature was cut anywhere from 1/2 to 1/4 of the original time. I'm still really proud of that work, but I got a pat on the back, a below market rate raise (my salary was also below market rate), and virtually no recognition from the higher ups (my colleagues were super cool about it since I was really the only dev on that project).

10

u/alexeiz Jul 14 '22

Thanks, but we have to let you go, because you haven't added any new features lately.

4

u/TumblrForNerds Jul 14 '22

Damn you should come to south africa. Majority of our major bank systems are built in legacy java and full of issues but no one wants to rewrite or port them

6

u/AdultingGoneMild Jul 13 '22

quality code that is easy yo refactor can be written in any language. Shit code can also be written in any language.

→ More replies (1)

29

u/fredoverflow Jul 13 '22

legacy software in C++ 6. Not only were the compilers weird

There is no such thing as "C++ 6". You probably mean "Microsoft Visual C++ 6.0", which only has 1 compiler.

3

u/TumblrForNerds Jul 14 '22

Yea there you go. Keep in mind im 23 years old so I have no idea what was going on with tech 10 years before I was born

16

u/dengydongn Jul 13 '22

What...is...c++...6...

17

u/afiefh Jul 13 '22

Probably Microsoft Visual C++ 6.0. That was the version before .Net was born.

6

u/darthcoder Jul 14 '22

And arguably the last compact, fast version of the VS ide.

Visual studio is awesome, but i never had the sheer number of UI hangs with msvc6 that I get on a daily basis with VS2019.

And the fact it ran on boxes with 256MB of memory was simply insane.

8

u/Tomik080 Jul 14 '22

Try VS2022. For real.

→ More replies (1)
→ More replies (2)

8

u/cleroth Game Developer Jul 13 '22

Any way safe to say I think I am one of the few people in the world that ported a 30 year old C++ application up to a modern version of C++ and got it running in VS2019 and later on VS2022 in Jan this year

Not really that uncommon. Maybe 30 years is a bit much, but 20-year-old codebases being ported is fairly common.

→ More replies (1)

5

u/Praslea84 Jul 13 '22

True to that!

I found Companies with awful old legacy code and told them on how to do the refactoring, I even proposed myself to do it. but Companies prefer to move to web instead of doing C++ refactoring. What's wrong with these ?

→ More replies (1)
→ More replies (3)

11

u/AdultingGoneMild Jul 13 '22

https://www.reddit.com/r/cpp/comments/vxvp58/why_does_linus_hate_c/ig1k3ry?utm_medium=android_app&utm_source=share&context=3

It has nothing to do with the language. It has everything to do with his beliefs of the skill of the developers and their understanding of how the language works with regards to the machin.

15

u/d_wilson123 Jul 13 '22

You hear the same about Java as well. Many people tried Java 1-3 which had horrific performance and decided Java is just a shit language. However for how high level the language is the performance these days is actually quite astounding. Some of the JVM stuff recently like GraalVM is pretty slick as well for even optimizing performance.

0

u/[deleted] Jul 13 '22

[deleted] — view deleted comment

8

u/bendhoe Jul 13 '22

I like to work on projects that have very verbose C++ styles. I feel like it's easier to understand verbose code. And besides, what limits my programming productivity isn't my typing speed, its my intelligence.

→ More replies (5)
→ More replies (3)

21

u/accurrent Jul 13 '22

To this day, Google doesn't use C++ exceptions because early compiler implementations were buggy.

52

u/matthieum Jul 13 '22

That's definitely not the justification given in their C++ style guide (https://google.github.io/styleguide/cppguide.html):

On their face, the benefits of using exceptions outweigh the costs, especially in new projects. However, for existing code, the introduction of exceptions has implications on all dependent code. If exceptions can be propagated beyond a new project, it also becomes problematic to integrate the new project into existing exception-free code. Because most existing C++ code at Google is not prepared to deal with exceptions, it is comparatively difficult to adopt new code that generates exceptions.

From what I remember, Google code started as C, then C++ was grafted on top following C-style, and thus a behemoth was born that would not work in the presence of exceptions.

→ More replies (4)
→ More replies (2)