Hacker News new | past | comments | ask | show | jobs | submit login

I started writing C++ to do some JSON at work and it is absolutely horrible piece of shit language (even with nlohmann's and simdjson). I cannot believe people live like this.

between figuring out CMake scripts, std::optional being basically useless. I never feel done writing code because I don't feel like I have:

1. Checked all the exceptions

2. Checked all the places where my std::optional instance is null (the checks doesn't propagate their information)

3. Checked that I am not doing any implicit conversion.

4. Really understand what happens at overflow?

5. Really understand if my code is even UB free?

6. Debugging is a mess, I can't step through code because the smartass compiler removes an entire segment of code even in debug mode.

7. I wish this garbage is written in C instead. At least its honest that its primitive and sinful, unlike this LARPING high level language.

Only 2 things need to be true for this language to be permanently horrible: Hyrum's Law and backward compability. If it is possible to write bad code, then there will be bad code. Simple as. Doesn't matter how many guidelines you write or how many times you need to "teach" programmers or how many times you said people just need to be "better mkayyy?"




"I started writing C++ to do some JSON at work and it is absolutely horrible piece of shit language"

Congratulations! That is the correct answer. Welcome to the language.

If you don't need to use C++, don't.

You need C++ for stuff like computer graphics, computational geometry, plausibly scientific computing, games and so on.

"6. Debugging is a mess, I can't step through code because the smartass compiler removes an entire segment of code even in debug mode."

Visual Studio is brilliant compared to anything else. If you really need to use C++, I would warmly suggest it.


> If you don't need to use C++, don't.

I have to because everything else is in C++ and I don't want to be the jackass that uses their favorite language that only they know in the company.


So you do need to use it :)


> Visual Studio is brilliant compared to anything else.

That's a bold statement. Clion and vs code are pretty great too, and last time i did a comparaison better than visual studio proper.


Oh! I've heard good stuff about Clion. I am pretty skeptical of vs code though, regarding comparing it's capabilities for C++ debugging and performance analysis. What plugins do you need nowadays. It's a good general purpose IDE for sure.


C++ is not for everybody. However it is one of the most successful programming languages in history. And there is a reason why. You might not personally be able to understand or appreciate why it is so successful of course. But that doesn’t change the fact that C++ runs the world.


i was thinking of learning cpp for webgpu, this is discouraging


Good. C++ is discouraging. It combines huge complexity with readily available footguns, and the prevailing attitude is that all developers must be able to write perfect code with a full understanding of the language. Otherwise any security holes or runtime crashes are their fault.


You are absolutely correct.

Computer graphics, though, is one of the few sane reasons left to learn C++.


Consider learning Rust instead, and use wgpu [1].

[1] https://github.com/gfx-rs/wgpu/


You can do it using whatever you want. I hope I don't discourage you from discovering C++. You might enjoy it, you might not, who cares. Go do it and make up your own opinion.


> 3. Checked that I am not doing any implicit conversion.

There are warnings for this that you should activate.

The rest is pretty much incurable.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: