Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - offsetvalue() return the offset address of an object http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 offsetvalue()       Return the offset address of an object
------------------------------------------------------------------------------
 Declaration
   memory.hdr

 Syntax
   func uint offsetvalue extern
   param untyped xObject

 Arguments
   xObject is a memory object.

 Return
   The offset address of the passed object.

 Description
   The offsetvalue() function returns the offset part of the memory address
   of the specified object.

 Example
   #define EXAMPLE_MEMORY
   #include example.hdr

   vardef static
      dbl  eVar
      char cString
   enddef
   
   proc Test_offsetvalue
   vardef
      uint aNums[ 10 ]
   enddef
   
   // print the offset address of various data objects
   ? offsetvalue( eVar )
   ? offsetvalue( cString )
   ? offsetvalue( aNums[] )
   
   // compare the address of an array produced using two methods (equal)
   ? makeptr( segmentvalue( aNums[] ), offsetvalue( aNums[] ) ) == &aNums[]
   endproc

   proc main
   Test_offsetvalue()
   endproc

See Also: & segmentvalue()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson