Type punning
From Wikipedia, the free encyclopedia
In computer science, a type punning is any programming technique that subverts or circumvents the type system of a programming language in order to achieve an effect that would be difficult or impossible to achieve within the bounds of the formal language.
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
|
In C and C++, constructs such as pointer type conversion and union
— C++ adds reference type conversion and reinterpret_cast
to this list — are provided in order to permit many kinds of type punning, although some kinds are not actually supported by the standard language.
In the Pascal programming language, the use of records with variants may be used to treat a particular data type in more than one manner, or in a manner not normally permitted.