4 ms·
> "Let me see the generated assembly in Godbolt" why, why? This is a embedded thing, not a C or C++ thing. The other day someone was saying here on HN that w
by AshamedCaptain 4y ago
> "Let me see the generated assembly in Godbolt" why, why?
This is a embedded thing, not a C or C++ thing.
The other day someone was saying here on HN that writing Verilog feels like following a process where "you already more or less know which circuit do you want, you are just trying to figure which is the specific Verilog code that will get your synthesizer to generate that circuit".
On embedded platforms (or generally anywhere where you count memory usage in units of KB or less), that's exactly what many people do. They already know more or less the assembly code, they are just looking for the right higher-level program that will translate to that assembly. That's one of the reasons they get angry when the language tries to be too smart.
The reason you just don't code in assembly directly is because it's still a pain and your chances of mistake increase (e.g. doing complex arithmetic expressions).
- vanderZwan 4y agoDoes that also mean that embedded programming involves being conservative about compiler updates? Because otherwise those choices might become completely invalid one upgrade later
- electroly 4y agoIt's not unreasonable to stick with the same compiler version for the entire life of a product. I was involved with a hardware project where we attempted to upgrade the compiler mid-lifecycle; it caused a subtle malfunction (almost certainly due to a latent bug or undocumented compiler behavior dependency in our code, but we couldn't find it) and we simply decided never to upgrade the compiler for the life of the product. It wasn't considered a big deal to do so.
- userbinator 4y agoThe basic principle is that known unknowns are better than unknown unknowns.
- ncmncm 4y agoWhich are in turn better than unknown knowns, or things you were just sure were true, but just ain't. Had you not been "sure", you might have done something that would work right.
- AshamedCaptain 4y agoIt's worse than that; many times the principle is: known evils are better than unknown angels.
- adrianN 4y agoFor safety critical software for example upgrading the compiler means you need to recertify the product. That's very expensive.
- vanderZwan 4y agoThat makes sense, and I'm glad to hear they have those strict rules given how terrible we are at making reliable software
- spyremeown 4y agoYea, I know all this jazz, I was, once upon a time, the dude unrolling loops in asm to get digital filters faster on PIC32s. It still a Linux box, with plenty of memory to spare. This IS a C++ problem, where people are driven to do these insane optimizations.