rebol - How to properly initialize a pointer to a double value within a struct? -


i'm trying pointer double value within struct can pass routine, having trouble getting value other 0. following has worked other struct! values i've used (such 1 containing binary!), not in case:

rebol []  speed1: make struct! [     d [double] ] [0.0] speed1*-struct: make struct! [i [int]] third speed1 speed1*: speed1*-struct/i 

here evaluation:

>>  speed1: make struct! [ [      d [double] [     ] [0.0] >>  speed1*-struct: make struct! [i [int]] third speed1 >>  speed1*: speed1*-struct/i == 0 

here working equivalent binary! struct:

>>  binary: make struct! [bytes [binary!]] reduce [head insert/dup copy #{} 0 8] >>  binary*-struct: make struct! [i [int]] third binary >>  binary*: binary*-struct/i == 39654648 

i can see difference in third function:

>> third speed1 == #{0000000000000840} >> third binary == #{f8145d02} 

however, not sure difference in length means in case. doing wrong? there different way pass pointers decimal value?

here way pointer double value:

speed1-struct: make struct! [s [struct! [d [double]]]] [0.0] speed1*-struct: make struct! [i [int]] third speed1-struct speed1*: speed1*-struct/i 

and evaluation showing returns pointer (shown int):

>> speed1-struct: make struct! [s [struct! [d [double]]]] [0.0] >> speed1*-struct: make struct! [i [int]] third speed1-struct >> speed1*: speed1*-struct/i == 37329176 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -