This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]