Type Cast

Noun · Development

Definitions

  1. An explicit runtime operation that converts a value from one type to another, potentially changing its underlying representation — such as `(int)3.14` in C truncating the fractional part, or `static_cast<Base*>(derived)` adjusting a pointer. Unlike a type assertion, a cast can involve actual computation and may fail or lose data.

    In plain English: Explicitly converting a value from one data type to another, which may change how it's stored or lose some information.

    Example: "Casting that double to an int silently truncated the decimal — that's why the totals were off by a few cents."

Related Terms