S
siju
Hi all,
the following post was saying that
http://groups.google.com/group/comp.lang.c/search?q=aarklon&start=30&sa=N&
The language doesn't allow conversions from floating-point to poitner
types, either implicitly or explicitly.
This piece of code does not perform a _conversion_ of floating-point
value to pointer type. What you have here is a _reinterpretation_ of
floating-point lvalue as pointer lvalue (raw memory reinterpretation).
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 ??
the following post was saying that
http://groups.google.com/group/comp.lang.c/search?q=aarklon&start=30&sa=N&
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);
This piece of code does not perform a _conversion_ of floating-point
value to pointer type. What you have here is a _reinterpretation_ of
floating-point lvalue as pointer lvalue (raw memory reinterpretation).
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 ??