This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
sizeof on const
- From: "Tal Agmon" <Tal dot Agmon at nsc dot com>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 27 Nov 2003 17:59:14 +0200
- Subject: sizeof on const
Hi,
I'm currently working on a new compiler port, which should be submitted to
GNU soon.
We're still waiting for the FSF assignment papers completion, so the legal
process are in progress.
We're using a 16-bit architecture, which doesn't support the 'long long'
type.
I have noticed that the following line yields different results for
different GCC (for our target) versions :
long a = sizeof(0100000000000);
GCC 2.95 : a=4;
GCC 3.2.3 : a=8;
GCC 3.3.2 : a=2;
The ISO-C standard does not implicitly relates to the case of 'sizeof'
applied on a constant, but indicates that the value of the result
is implementation-defined.
Can someone explain the reason for the differences ?
Regards,
Tomer
tomer.levi@nsc.com
National Semi-Conductor