Ask HN: C or C++?

1 pointsposted 10 hours ago
by skwasimin

Item id: 49680346

4 Comments

saidnooneever

8 hours ago

I used to use C for everything. Lately been trying C++. enjoying it, but do feel its 'too much runtime'. i dont like my code doing stuff itself. its much more satisfying to write it yourself and see it go faster because its less generically build.

I think for embedded i cant imagine putting a thick rust or cpp runtime on such poor device. for PC platform arguably c++ is also good enough since there u get tons of resources.

Look at it this way. you wanna build a bike:

C gives you bunch of raw materials. oil, rubber, iron ore, coal. You can make a bike but first you need to think what is this bike and how i want to make it. what does it consist of. what is a wheel?

c++ give you tires, spokes, brake cables etc. but no manual. lots of building components, screws etc. U can make any bike u want but it will be a classical sort of bike, its components will look like its a bike)

other languages give u wheels, frame, helmet. u will get same bike as anyone. easy to get it though.

uecker

9 hours ago

I will take the bait. The reasons I use C: Fast compilation times, long-term stability, portability to many architectures, multiple implementations (no lock-in to a single industry controlled implementation), high performance, conceptually minimalistic, relatively simple to understand, learn and teach, many resources, it has an international engineering standard, if needed you can always bend the rules to achieve your goal - especially in the context of embedded and systems programming, generally still evolving in the right direction, and - also a big factor - it is just fun to write.

samoit

10 hours ago

Go for Rust/golang, forget c/c++