Page 1 of 1

Change of Pointer-Type

Posted: Mon Sep 28, 2015 9:07 pm
by GPI
At the moment we must write this:

Code: Select all

long.l
*pointer=@long
*long.long=*pointer
*long\l=10
Ok, the example is a little bit stupid, but sometimes you must change the type of the pointer like above. At the moment we must create a new one and copy the adress to the new pointer.
My suggestion:

Code: Select all

long.l
*pointer=@long
(*pointer).*long\l=10
;the star is here important, because it indicate a pointer.

Other possibilities to use this:

Code: Select all

Structure duo
  StructureUnion 
    q.q
    d.d
  EndStructureUnion
EndStructure

double.d=10.2
Debug Hex( (double).duo\q ); should be "4024666666666666"

Re: Change of Pointer-Type

Posted: Tue Sep 29, 2015 6:45 am
by STARGĂ…TE
I think, in your cases it is easier, to use Peek and Poke:

Code: Select all

long.l
PokeL(@long, 10)

Code: Select all

double.d=10.2
Debug Hex( PeekQ(@double) )