help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: G++ optimization bug?


From: Larry Smith
Subject: Re: G++ optimization bug?
Date: Sat, 07 Apr 2007 14:00:32 GMT
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2) Gecko/20061107 SUSE/1.1.1-0.1 SeaMonkey/1.1.1

Ulrich Eckhardt wrote:
> Larry Smith wrote:
>>     // hmmm, pointers on 64 bit hdw are 'long',
>>     // not 'long long'.
>>     // int is 32 bits, long is 64 bits, ptr is
>>     // 64 bits.
> 
> Sorry, but that is not universally true. You can be reasonably sure that a
> pointer has the same size as a size_t or a ptrdiff_t, but other than that
> all bets are off. Now, the LLP64 model makes the long long and pointers 64
> bits, while long stays 32 bits. The LP64 model uses 64 bit long and
> pointers, which is what Linux uses on 64 bit hardware.
> 


My comment is based on the hdw/OS combo's we target:
  SPARC_64/Solaris, PPC_64/SUSE, X86_64/SUSE, & X86/SUSE.
On the 64 bit hdw using 'g++ -m32' longs & ptrs are both 32 bits;
and using 'g++ -m64' longs & ptrs are both 64 bits.
Since the OP is using X86_64/Redhat, I made the
leap that it would be the same as what we're using.
But maybe it's not.


>>   printf("%u = sizeof int\n", sizeof(int) );
>>   printf("%u = sizeof long\n", sizeof(long) );
>>   printf("%u = sizeof ptr\n", sizeof(void *) );
>>   printf("%u = sizeof long long\n", sizeof(long long) );
> 
> FYI: with 64 bit size_t and 32 bit unsigned, you have a mismatch between
> the printf arguments and its format string. Did you compile with any
> warnings?
> 

Yes, those format specifiers are wrong - sorry...
It was late & I forgot to use any compiler warning options.

> Uli
> 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]