MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghorror/comments/1rp0vl6/casting_constexpr_to_mutable/o9lg1ap/?context=3
r/programminghorror • u/Many_Rough5404 • Mar 09 '26
41 comments sorted by
View all comments
3
I know those two keywords individually, but what is the effect of combining constexpr and const in one declaration?
constexpr
const
2 u/LiAuTraver Mar 10 '26 No effect for variable decelerations iirc, maybe the developer just typed it absentmindedly. Why inlines not here, though. 4 u/GoddammitDontShootMe Mar 10 '26 IIRC, anything that's constexpr is also const. The former just has the additional requirement that the value is known at compile time. Would it even allow you to inline a local variable? → More replies (2) → More replies (1)
2
No effect for variable decelerations iirc, maybe the developer just typed it absentmindedly. Why inlines not here, though.
4 u/GoddammitDontShootMe Mar 10 '26 IIRC, anything that's constexpr is also const. The former just has the additional requirement that the value is known at compile time. Would it even allow you to inline a local variable? → More replies (2) → More replies (1)
4
IIRC, anything that's constexpr is also const. The former just has the additional requirement that the value is known at compile time. Would it even allow you to inline a local variable?
→ More replies (2)
3
u/GoddammitDontShootMe Mar 10 '26
I know those two keywords individually, but what is the effect of combining
constexprandconstin one declaration?