In LP64, sizeof has the effective type of an unsigned
long
. Occasionally, sizeof is passed to a function
expecting an argument of type int
, or is assigned or cast to
an int
. In some cases, this truncation might cause loss of data.
For example,
long a[50]; unsigned char size = sizeof (a);
produces the warnings:
warning: 64-bit constant truncated to 8 bits by assignment warning: initializer does not fit or is out of range: 0x190