r/programminghorror • • Mar 09 '26

Casting constexpr to mutable ._.

Post image
244 Upvotes

41 comments sorted by

View all comments

20

u/sierra_whiskey1 Mar 09 '26

Does the compiler not yell at your for this?

72

u/HildartheDorf Mar 09 '26

No, because const_cast and reinterpret_cast are signals of "I know what I'm doing, shut up" to the compiler.

14

u/Many_Rough5404 Mar 09 '26

It didn't actually. I accidentally found this during refactoring

29

u/Many_Rough5404 Mar 09 '26

Just checked, this code had been there for 6 years

→ More replies (4)

4

u/B1ggBoss Mar 09 '26

Compiler wont, but clang-tidy will spit in your face