Archive for the ‘Type Casting’ Category

Type Casting in C++

The new C++ standard is full of powerful additions to the language: templates, run-time type identification (RTTI), namespaces, and exceptions to name a few. Rather than talk about one of these “major” extensions, I will discuss one of the minor extensions: the new C++ casting operators.
The C++ draft standard includes the following four casting operators:

static_cast
const_cast
dynamic_cast
reinterpret_cast

These [...]

Continue Reading..
Posted in Type Casting

Implicit Type Conversions – part 2

Standard Type Conversions
Many C and C++ operators cause implicit type conversions, which change the type of an expression. When you add values having different data types, both values are first converted to the same type. For example, when a short int value and an int value are added together, the
short int value is converted to [...]

Continue Reading..
Posted in C Tidbits, Type Casting