int :sizeof ( string $TYPENAME )
Returns the size (in bits) of given value type. Can be used to check the precision of processor-dependent types.
Note that for types of dynamic size (that is, string, array, dictionary) value returned refers solely to the estumpe - or, put otherwise, an empty value of given type. A value that has some data associated will grow in size, and, as a result, can occupy much more memory than the number returned.
Also, note that this refers solely to the value itself and does not include whatever overhead caused by the interpreter storing type and runlevel information, symbol table entries, et cetera.
Possible input values:
bin
, oct
, int
, hex
- return size of integersflo
, float
- return size of floatslog
, bool
- return size of boolean valuesstr
, string
- return size of string stumparr
, array
- return size of empty arraydict
- return size of empty dictionary# Check float size !if :eq i80 :sizeof s'float' :writeln s'Yay, floats are 80 bits!' !else :writeln s'Meh, floats are pesky 64bits.' !fi
wikipage modified on 2014/0601/2317