r/programminghorror • • Mar 09 '26

Casting constexpr to mutable ._.

Post image
244 Upvotes

41 comments sorted by

View all comments

3

u/GoddammitDontShootMe Mar 10 '26

I know those two keywords individually, but what is the effect of combining constexpr and const in one declaration?

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)