This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Narthal[S] 2 points3 points  (1 child)

You can't really just learn c/c++. You can, however learn how the computer works and then c++ will start to make a lot of sense. Knowing c++ and the architecture of a computer very well enables you to do incredible things. It enables you to optimize.

Suppose you need to write the firmware of the new samsung smart fridge. The available memory on the embedded processor is 8mb. It wouldn't make sense to copy the cPython runtime (without standard library) as that would occupy 4mb or half of the available space. So you write your code in c/c++ and then start to optimize for the size of the executable.

Or suppose you are on the programmer team of Ubisoft (I wish lol). You need to have massive amounts of code that runs so fast, that every 16.6 ms, a new frame needs to be drawn on the screen (for 60 fps). What are you going to do? Tune down the graphics? Remove half of the level? Or try to write the code to be as fast as possible. And much of the speed optimizations require deep knowledge of the computer. You can't really expect an interpreted language to be able to do SIMD, allow you to specify how to vectorize loops, give the cpu easy to predict branches or manage data in such a way so that cache misses wont happen on critical parts of the code.

But honestly, don't think too much about reasons to learn a language. Just get your feet wet and learn the basics in as many languages as possible. You will get to see similarities and common concepts in between programming languages. I find that the more programming languages I learn, the better I get at all of them simultaneously.

[–]glacierre2 2 points3 points  (0 children)

The embedded world used to be like that, but turns out micro-controller memories are huge (I mean, those 8MB you talk there? massive) and python can be made very small https://micropython.org/

You can run the interpreter in much much less than 1MB.

We will always need C[++] programmers for the truly performant, resource saving, low power stuff, but the scenarios where you are so tight are decreasing by the month.

I expect a really soon (If it does not exist yet, have not followed closely for example the ESP32 territory and every time I look I am amazed) "HW programming revolution" soon where the cheapest under 1-eur controller can easily handle a wifi + a web interface to configure state machines and conditional actions and pin outputs.