Hacker News new | ask | show | jobs
by sail0rm00n 2901 days ago
C++, but you're better off just starting with rust. C++ is a bottomless, dark pit.

The primary reason to learn it first is to focus on manual memory management. You could also just delve into C, but I still recommend just beginning with rust and skipping the cruft.

2 comments

C++ is a bottomless, dark pit.

It's an archaeological dig of a language, representing something like 4 major strata. Archaeological digs have pits. The way to learn C++ is to limit scope and learn a particular style of C++.

I like to guide newbies I'm training in C++ to only ever use stack allocated objects and pass everything by ref for as long as possible. I think avoidance of utilizing the heap is a great idea while you're still learning and... Eh, I'm getting less sold on the performance benefits of direct heap allocation instead of using various framework (Yay Qt) or STL structures that wrap around heap allocations vs. the trade off in maintenance. (Performance definitely improves but it isn't by as much as you might think and the cost is non-negligible)
Eh, I'm getting less sold on the performance benefits of direct heap allocation

What's your application for high performance?

There isn't one, if I was working in an embedded environment I might be much more enthusiastic about heap allocation, but since I tend to work on systems that value maintenance above eek out every cycle they can... cutting direct heap allocation out has greatly improved our dev speed.

FYI, I still do utilize heap allocated objects via STL & framework objects, I just leave all heap memory management to wheels I don't invent in house.

It's not bottomless, you just cant see the bottom from the surface.
You will never see it completely, because it is full of undefined behavior, and is constantly being excavated to make room for more features.