Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
N : Integer := (T'Size + 7) / 8;
n = sizeof (t);
int n = sizeof(T);
int n;
unsafe
{
n = sizeof(T);
}
auto n = T.sizeof;
<T> int bytes(T t) {
return switch (t.getClass().getSimpleName()) {
case "Boolean" -> 1;
case "Byte" -> Byte.BYTES;
case "Short" -> Short.BYTES;
case "Character" -> Character.BYTES;
case "Integer" -> Integer.BYTES;
case "Float" -> Float.BYTES;
case "Long" -> Long.BYTES;
case "Double" -> Double.BYTES;
default -> -1;
};
}
n := SizeOf(T);
use Devel::Size qw(total_size);
my $n = total_size $t;
n = getsizeof(t)
let n = std::mem::size_of::<T>();