• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: OT large integer constants
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OT large integer constants


  • Subject: Re: OT large integer constants
  • From: Steve Checkoway <email@hidden>
  • Date: Wed, 28 May 2008 02:25:36 -0700


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:

This email sent to email@hidden

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

  • Prev by Date: display of char *
  • Next by Date: [OT] best C++ mailing list related to Apple?
  • Previous by thread: OT large integer constants
  • Next by thread: Re: OT large integer constants
  • Index(es):
    • Date
    • Thread