Variable size/Get: Difference between revisions

Content added Content deleted
m (→‎{{header|Forth}}: fixed </Lang> tag)
No edit summary
Line 1,368: Line 1,368:
print(@"$(sizeof(int))\n");
print(@"$(sizeof(int))\n");
}</lang>
}</lang>

=={{header|Vlang}}==
<lang>sizeof(i64)</lang>
{{out}}
<pre>8</pre>

=={{header|Wren}}==
In Wren all variables have a size of 8 bytes though there is a larger, slower representation which is used for debugging the virtual machine. Consequently, no ''sizeof'' function (or similar) is needed.

Numbers, booleans and the special value ''null'' are stored directly within the variable's storage location using a technique known as ''NaN tagging'' and are therefore unboxed. For everything else (strings, class instances, lists etc.) the variable's storage location stores a pointer to where the actual data resides on the heap.

=={{header|Yabasic}}==
<code>frnfn_size</code> return the size (in bytes) of one of the types available for foreign function calls.
<lang yabasic>print frnfn_size("uint8") //1
print frnfn_size("int8") //1
print frnfn_size("uint16") //2
print frnfn_size("int16") //2
print frnfn_size("uint32") //4
print frnfn_size("int32") //4
print frnfn_size("uint64") //8
print frnfn_size("int64") //8
print frnfn_size("float") //4
print frnfn_size("double") //8
print frnfn_size("char") //1
print frnfn_size("int") //4
print frnfn_size("short") //2</lang>


=={{header|XPL0}}==
=={{header|XPL0}}==
Line 1,396: Line 1,422:
8
8
</pre>
</pre>

=={{header|Wren}}==
In Wren all variables have a size of 8 bytes though there is a larger, slower representation which is used for debugging the virtual machine. Consequently, no ''sizeof'' function (or similar) is needed.

Numbers, booleans and the special value ''null'' are stored directly within the variable's storage location using a technique known as ''NaN tagging'' and are therefore unboxed. For everything else (strings, class instances, lists etc.) the variable's storage location stores a pointer to where the actual data resides on the heap.

=={{header|Yabasic}}==
<code>frnfn_size</code> return the size (in bytes) of one of the types available for foreign function calls.
<lang yabasic>print frnfn_size("uint8") //1
print frnfn_size("int8") //1
print frnfn_size("uint16") //2
print frnfn_size("int16") //2
print frnfn_size("uint32") //4
print frnfn_size("int32") //4
print frnfn_size("uint64") //8
print frnfn_size("int64") //8
print frnfn_size("float") //4
print frnfn_size("double") //8
print frnfn_size("char") //1
print frnfn_size("int") //4
print frnfn_size("short") //2</lang>


=={{header|zkl}}==
=={{header|zkl}}==