Variable size/Get: Difference between revisions
add →Free Pascal
m (→{{header|Fortran}}: corrected a misspelling.) |
(add →Free Pascal) |
||
Line 399:
=={{header|Delphi}}==
<lang delphi>i := sizeof([any variable or
=={{header|Elixir}}==
Line 500:
A double occupies 8 bytes
</pre>
=={{header|Free Pascal}}==
The FPC (Free Pascal compiler) supports the UCSD Pascal extension <tt>sizeOf</tt>.
See [[#Delphi|Delphi]] for an example.
It can be used in compile-time expressions, too.
Furthermore, the GNU Pascal extension <tt>bitSizeOf</tt> is available, too, which is particularly interesting for <tt>packed</tt> structures’ members.
=={{header|Gambas}}==
Line 891 ⟶ 897:
=={{header|Pascal}}==
Pascal discourages the programmer to care about specific data sizes.
Nevertheless [[#Delphi|Delphi]], [[#Free Pascal|FPC]] and GPC (GNU Pascal compiler) among other compilers support the UCSD Pascal extension <tt>sizeOf</tt>.
=={{header|Perl}}==
Line 1,210 ⟶ 1,216:
=={{header|TXR}}==
All Lisp values are pointer-sized cells, so they have a basic size that is four or eight bytes, depending on whether the processor architecture is 32 or 64 bits. Heap values take up a four-cell record. And some objects have additional dynamically allocated memory. The <code>prof</code> operator can be wrapped around code which constructs and returns an object to calculate the size of the heap part plus dynamically allocated memory:
Line 1,237 ⟶ 1,243:
"foobar"</pre>
In the FFI type system, the <code>sizeof</code> macro operator reports size of types.
Line 1,271 ⟶ 1,277:
The leading bitfield is now deemed to be byte aligned, so the structure is no longer padded for the sake of its alignment.
Since the task is worded as being about '''variables''' rather than objects, what we can do is explore the memory costs of a lexical environment.
|