Embed Notice
HTML Code
Corresponding Notice
- Embed this notice@p @diresock @SuperDicq >There's often a hundred different ways you can convert C code to Assembly with exactly the same result. However, we tend to want the most optimized solution.
yes, and I wrote software and microcode in assemblers sometimes or used assembly parts in C/C++ code for optimization. assembler is fine if you know what you do. I really don't need "more optimized solution". and I doubt it's needed at all. I started to write in C when I was 12 and it was not a problem for 12 years old to cope with plain Borland Turbo C compiler that was quite straight and simple. it's a programmer who thinks what he writes, not a compiler.
overflow is not an undefined behavior, actually. it's exact on each architecture and one can check it with assemblers.
and clang is coprorate BS, imho. I never use it and don't recommend it to anybody who wants to write in C. compiler should not "expect" anything from code. it should not change code in any way. it should comply to standards and that's all.
and automatic optimizing of code is very slippery slope. I had seen many errors in compilers that referred to optimization. since, I'm very cautions toward optimization options, especially on microcontrollers, etc. btw, sometimes assembly inlines are the way to bypass the bugs of a compiler.