C-style casting

suggest change

C-Style casting can be considered ‘Best effort’ casting and is named so as it is the only cast which could be used in C. The syntax for this cast is (NewType)variable.

Whenever this cast is used, it uses one of the following c++ casts (in order):

Functional casting is very similar, though as a few restrictions as the result of its syntax: NewType(expression). As a result, only types without spaces can be cast to.

It’s better to use new c++ cast, because s more readable and can be spotted easily anywhere inside a C++ source code and errors will be detected in compile-time, instead in run-time.

As this cast can result in unintended reinterpret_cast, it is often considered dangerous.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Explicit type conversions:
* C-style casting

Table Of Contents
8 Arrays
11 Loops
39 Streams
51 Unions
56 Lambdas
60 SFINAE
62 RAII
67 Sorting
83 Explicit type conversions
84 RTTI
87 Scopes
104 Profiling
107 Recursion
117 Iteration
125 Alignment
134 Semaphore
136 Debugging
139 Mutexes
142 decltype