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 - typedef derived data type specifier http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 typedef             Derived data type specifier
------------------------------------------------------------------------------
 Syntax
   typedef <datatype> <declarator>

 Arguments
   <datatype> is a primitive data type that exists in the Force language.
   <declarator> is a synonymoe for the type.

 Description
   The typedef keyword is used to assign a synonyme for an existing
   data type. The newly derived data type can be used identically to the
   original one. This is useful for giving a data type a name that is more
   meaningful in its specific uses, like when a ulong is a pointer to a
   particular sort of object.

   Typedefs can be nested, that is can refer to earlier typedefed derived
   types. In Force typedefs can not be composite, that is they can only
   replace data type keywords and other typedefs, but can not contain
   type modifiers (like value or const).

   The defined type names are case insensitive. The significant
   length for derived types is maximum 32 characters, like other symbols
   in Force.

 Example
   #define EXAMPLE_KEYWORD
   #include example.hdr

   typedef logical BOOL
   typedef ulong   DWORD
   typedef ulong   MEMPTR
   typedef MEMPTR  BUFFPTR
   typedef _SLIST  PICKHANDLE
   typedef MEMPTR  FUNCPTR
   typedef uint    WORD
   typedef uint    COUNTER
   
   proc Test_typedef
   vardef
      PICKHANDLE pList
      COUNTER    n
   enddef
   clear
   pList := pickinit()
   for n := 0 to 11
      pickadd( pList, __monthnames[ n ] )
   next
   pickdisp( pList, 11, 35, 17, 45 )
   pickclear( pList )
   endproc

   proc main
   Test_typedef()
   endproc

See Also: typedef struct

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