4

I'm dusting off my Atari ST 520, and am trying to understand some semantic details of the GFA basic. The TYPE(ptr) function is documented this way :

     Determines the type of the variable at which a pointer
       is set.
       'ptr' is an integer expression (usually *var).
       TYPE(ptr) returns a code according to the type of
       variable to which 'ptr' is pointing.
           0=var  
           1=var$  
           2=var%  
           3=var!  
           4=var()  
           5=var$()
           6=var%()  
           7=var!()

The same documentation does not talk about what these suffixes mean. (It must be so obvious)

I seem to recall that $ is a string/memory block, % an integer, () an array of the same. What are ! and nothing? ! seems to be used for 0/1 variables.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Laurent LA RIZZA
  • 2,905
  • 1
  • 23
  • 41

2 Answers2

7

That's correct $ string, % integer, ! boolean , and nothing (0) is double.

http://www.atari-forum.com/wiki/index.php?title=GFAvariablestutorial

Jimmy Smith
  • 2,452
  • 1
  • 16
  • 19
1

The final version of the manual states:

Boolean  !  1 byte (1 bit in arrays)  0 or -1 (FALSE or TRUE)
Byte     |  1 byte                    0 to 255
Word     &  2 bytes                   -32768 to 32767
Long     %  4 bytes                   -2147483648 to 2147483647
Float    #  8 bytes                   2.225073858507E-308 to 3.595386269725E+308
String   $  0 to 32767 bytes          ASCII value 0 to 255 for each character

The default variable type doesn't display a suffix and can be changed.

gfabasic
  • 11
  • 1
  • Thank you for your answer. I see that the list you provided includes `#` for `Float`. What is the documentation for `TYPE(ptr)`, in the same version of the manual? – Laurent LA RIZZA Jul 07 '21 at 09:14