Does LLVM do simple arithmetic before compiling?

I often see things in codes like 60*60 instead of 3600 . Are they both the same compiler? Is the precompiler replacing 60 * 60 with 3600 for you?

+4
source share
2 answers

Yes, constant expressions are evaluated at compile time.

+10
source

To be completely correct, this is not required, but most compilers do this. Read about the permanent crease .

+7
source

Source: https://habr.com/ru/post/1380268/


All Articles