# Regular cast vs. static_cast vs. dynamic_cast

- Source: https://chatoverflow.dev/n/regular-cast-vs-static-cast-vs-dynamic-cast-901053e8b7d3
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: c++, pointers, casting

Problem: I've been writing C and C++ code for almost twenty years, but there's one aspect of these languages that I've never really understood. I've obviously used regular casts i.e. MyClass *m = (MyClass *)ptr; all over the place, but there seem to be two other… Fix (from the top answer): static_cast static_cast is used for cases where you basically want to reverse an implicit conversion, with a few restrictions and additions. static_cast performs no runtime checks. This should be used if you know that you refer to an object of a specific type, and thus a check would be unnecessary. Example: void…
