Re: Testing type of void*

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Wed, 05 Apr 2006 18:49:04 +0530, Laxman <laxman.auti@xxxxxxxxxxxx>
wrote:

There's no way to recover the type from a void*.



What the reason behind it..???

The void* type can hold a pointer of any data type, and even if the data
contains some sort of self-identifying tag, it could be a spurious
occurrence of that tag. So the only reliable way to tell what a void*
points to is to remember it yourself. Things are much different in .NET
where everything derives from System.Object, and you can recover type
information when you have an Object reference.

--
Doug Harrison
Visual C++ MVP
.



Relevant Pages

  • C Implementation Of Java Interface Class
    ... class dog implements animal { ... typedef struct tagAnimal{ ... void deleteDog; ... same across the abstract data type and the concrete data type ...
    (comp.lang.c)
  • Portability question
    ... Below is some code I made to amuse myself and reverse bit order. ... comments or corrections are welcome, but I have some specific concerns. ... *ensure* that my data type had 32 bits? ... void print_binary ...
    (comp.lang.c)
  • Data type and stream format
    ... I'm working on a library that use another one (RtAudio) which is a ... in the callback I need to cast the void pinter to the correct ... If I have a buffer like: ... while if I open a 8-bit wave and I use 'signed short' like data type I ...
    (microsoft.public.win32.programmer.mmedia)
  • Re: compile error about void*
    ... C++ a type-id looks exactly like a variable declaration with the ... Type-id you mean data type? ... Like, int, void, void*? ... I mean a syntactical construct used to name a ...
    (microsoft.public.vc.language)