Should I use a C++ reinterpret_cast over a C-style cast?

The problem with C-Style casts is that they do a lot under the hood. See here for a detailed explanation: http://anteru.net/2007/12/18/200/

You should try to always use the C++-casts, makes life easier in the long run. The main problem with C-style casts in this case is that you could have written (char*)(&v) while with reinterpret_cast, you would need an additional const_cast, so it’s a bit safer. Plus you can easily find reinterpret_cast with a regex, which is not possible for the C-style casts.

Leave a Comment