Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OT large integer constants




On May 28, 2008, at 1:24 AM, email@hidden wrote:

as i am writing some 64-bit test code i want to check if
a certain result equals a certain number like:

if(mymicro1.microdata()==3048117485400){
   b=0;
   }

the constant '3048117485400' however is rejected by gcc with the error mess
integer contstant too large for type, on the net i found that i should write

That's right, it's too large for a 32 bit long. If you compile with - arch ppc64 or -arch x86_64 then long will be 64 bits and it should work.


3048117485400ULL
of
3048117485400LL

but this results in the error
use of C99 long long integer constant

[steve$ cat large.c #include <inttypes.h> uint64_t foo() { return 3048117485400ULL; } steve$ gcc -Wall large.c -c

No errors.

what am i to do if i want to keep maximum portability?


The best you can do is follow standards really. Without knowing with which other compiler you will be compiling this, it's hard to say more.

--
Steve Checkoway

    "Anyone who says that the solution is to educate the users
    hasn't ever met an actual user." -- Bruce Schneier




Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden

References: 
 >OT large integer constants (From: email@hidden)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.