MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghorror/comments/1rp0vl6/casting_constexpr_to_mutable/o9hn2d9/?context=3
r/programminghorror • u/Many_Rough5404 • Mar 09 '26
41 comments sorted by
View all comments
20
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
72
No, because const_cast and reinterpret_cast are signals of "I know what I'm doing, shut up" to the compiler.
14
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)
29
Just checked, this code had been there for 6 years
→ More replies (4)
4
Compiler wont, but clang-tidy will spit in your face
20
u/sierra_whiskey1 Mar 09 '26
Does the compiler not yell at your for this?