-2

What is the term used (say, by programming language theorists) for the act of casting a void pointer into a pointer to a type? Is it "upcasting"? "type infusion"? "typing"?

Notes:

  • It is obviously a cast, and obviously a reinterpreting cast - but I'm looking for a more specific term, expressive of the transition from an untyped to a typed pointee.
  • Please do not argue about whether it's a good idea to avoid this or not, that is really not the question.
einpoklum
  • 118,144
  • 57
  • 340
  • 684

2 Answers2

2

If you wanted to make up a new term, you could call it type unerasure.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
  • That term is assuming the target type was once erased, which is not necessarily the case. – einpoklum Feb 20 '16 at 20:14
  • @einpoklum: How so? Is there some way of creating objects of type `void` that I'm not aware of? If you're referring to interpretation of serialised data then I submit that the original data still had a type, even if only by the as-if rule :) – Lightness Races in Orbit Feb 20 '16 at 20:20
  • Well, while it's probably/certainly the case something was cast into a void*, it's very possible the reinterpreting cast will not be back to that type. I might have had a char*, played with the bits, and ended up with a valid float at the target address. But, you know, I guess it's a good enough term on second thought. Accepted. – einpoklum May 10 '16 at 22:26
  • @einpoklum: _Type invention_ perhaps ;) – Lightness Races in Orbit May 10 '16 at 23:45
1

I'd say such is brute force casting (or just casting like the c nitpickers will call it) like it's represented in c++ with the proper reinterpret_cast<>, hence reinterpret casting.

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190