Quantcast
Channel: Is `const constexpr` on variables redundant? - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer by Sergey Kalinichenko for Is `const constexpr` on variables redundant?

In declarations with primitives, such as the one in your example, const is indeed redundant. However, there may be odd situations where const would be required, for exampleconstexpr int someConstant =...

View Article


Answer by Maxim Egorushkin for Is `const constexpr` on variables redundant?

const is redundant in const constexpr for objects.Does "object declaration" mean "any variable declaration"?It does.As per cppreference, a variable or a constant is an object:A variable is an object or...

View Article


Is `const constexpr` on variables redundant?

cppreference states that:A constexpr specifier used in an object declaration or non-static member function (until C++14) implies const.Does "object declaration" mean "any variable declaration"?I.e....

View Article
Browsing all 3 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>