+ 1

Why do we use constexpr and const in c++

I don't understand the use of constexpr and const.why would we want to make a variable immutable?

12th Jun 2017, 1:33 PM
Asif
Asif - avatar
1 Resposta
+ 4
It will enable the compiler to make optimizations in the code, making it faster. Const declarations tell the compiler that the variables are read-only.
12th Jun 2017, 2:04 PM
Karl T.
Karl T. - avatar