Hi all,
the following post was saying that
The language doesn't allow conversions from floating-point to poitner
types, either implicitly or explicitly.
What?
float x = 1.0f;
void *p = *((void**)&x);
void *p = *((void**)&x);
value to pointer type. What you have here is a _reinterpretati on_ of
floating-point lvalue as pointer lvalue (raw memory reinterpretatio n).
This is a completely different thing in C language world.
For example, in C language _converting_ a pointer of type 'T*' to
'void*' type and back is defined and has its uses. However, trying to
_reinterpret_ a pointer of type 'T*' as a 'void*' pointer (using the
above technique) leads to undefined results. Feel the difference.
now my questions are
1) in C language _converting_ a pointer of type 'T*' to
'void*' type and back is defined and has its uses.
can anyone give examples especially on uses???
2) However, trying to _reinterpret_ a pointer of type 'T*' as a
'void*' pointer (using the above technique) leads to undefined
results.
explanation on un defined results ??
Comment