2 ms·
To reiterate, claiming that C can be described as "portable assembly" is not a claim that it is literally a package of assembler macros that emit deterministic
by jmillikin 2y ago
To reiterate, claiming that C can be described as "portable assembly" is not a claim that it is literally a package of assembler macros that emit deterministic machine code for each individual source expression.
I linked these in another comment, but here's some examples of straightforward-looking integer addition emitting more complex compiler output for other languages that compile to native code:
Haskell: https://godbolt.org/z/vdeMKMETT https://godbolt.org/z/vdeMKMETT
C++: https://godbolt.org/z/dedcof9x5 https://godbolt.org/z/dedcof9x5
- eru 2y agoThe Haskell version deals with both laziness and also detects overflow. Your C++ example has a lot more code than the C example, I'm not sure why you'd expect it to produce the same output?