Jump to content

Standard Types

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
roboticforest

roboticforest

    Programmer

  • Members
  • PipPipPipPip
  • 110 posts
Is there a language standard C++ type that's 64 bits in size?

Visual C++ supports __intn where n can be 8, 16, 32, or 64, but what about other compilers? Are these types supported on Mac, or Linux compilers as well?

Apparently the long long int type is part of the C standard, but is it part of C++ yet?

I'm having trouble finding non-Microsoft specific information on this topic, and I'm also having trouble finding information newer than 2005.
Dave

#2
Coder Zombie

Coder Zombie

    Newbie

  • Members
  • PipPip
  • 28 posts
Well C++ defines that:
short has to be at least 16bits,
int has to be at least 16bits
long has to be at least 32bits

C++ has not adopted the long long type like C99 so I do not think that C++ has a portable 64bit int type yet.But the standard does not declare max int sizes so almost all 64bit systems use long as the 64bit type. Here is a link to explain a little more.http://home.att.net/...c/inttypes.html

If you need portable big numbers GMP is nice The GNU MP Bignum Library
the GMP C++ classes overload the operators so they are much easier than Java big nums. GMP is LGPL so you can use it in non free software too.
I'm the master of code rot

#3
roboticforest

roboticforest

    Programmer

  • Members
  • PipPipPipPip
  • 110 posts
Thank you very much my undead friend.
Dave

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
C++ is designed with portability in mind. As a result, it has to work on a variety of systems. Having the types you are suggesting is actually contrary to the C++ approach to doing things.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog