suve
Warning: Illegal string offset 'doublequoteopening' in /usr/home/svgames/domains/svgames.pl/public_html/dokuwiki/inc/parser/xhtml.php on line 766 Warning: Illegal string offset 'doublequoteclosing' in /usr/home/svgames/domains/svgames.pl/public_html/dokuwiki/inc/parser/xhtml.php on line 774

awful: function: sizeof

declaration

int :sizeof ( string $TYPENAME )

summary

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 integers
  • flo, float - return size of floats
  • log, bool - return size of boolean values
  • str, string - return size of string stump
  • arr, array - return size of empty array
  • dict - return size of empty dictionary

example

# 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