The C language does not have the object-oriented features that make it meaningful to ask about the run-time type of an object in C++.
You typically implement genericity in C by casting to and from void*
. Example: the C function qsort.
If your question is about determining at run-time what actual type a void*
pointer points to, that's impossible. The information is simply not stored at all by most compilers.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…