Re:C constructs that still don't work in C++
by spacechild1 on Tuesday May 26, 2026 @04:08PM
(#48285294)
I see your point. It would be nice if a C-style cast behaved like a static_cast in C++, but that's not possible because of backwards compatibility. At least with GCC/Clang you can disable C-style casts altogether with '-Werror=old-style-cast'. (Maybe there is a similar option for MSVC.)
[ Parent
| on HN ]
Re:C constructs that still don't work in C++
by account42 on Wednesday May 27, 2026 @03:28AM
(#48290882)
Yes, this is something that would need a new language edition to properly fix. Compiler vendors could split -Wold-style-cast into separate warnings for static_cast and other usage though so that you can only ban one of them.