increase integer limit?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pgupta0609
    New Member
    • Mar 2010
    • 4

    #1

    increase integer limit?

    u have said that integer length depends upon machine-to-machine. can i increase the integer limit on my own?
    does a 32-bit system has different limit than 64-bit system?
  • RedSon
    Recognized Expert Expert
    • Jan 2007
    • 4980

    #2
    Usually integer is understood to be a 32bit value. Using "int" I believe this is pretty standard. However the internal representation of an int can be independent of the machine. You will have to check the documentation of your compiler and platform. If you want to use a larger value you can look for datatypes like _int64 or double long or something like that.

    Provide more information about your compiler and platform and then we can provide more specific information.

    Comment

    • Banfa
      Recognized Expert Expert
      • Feb 2006
      • 9067

      #3
      On a 64 bit Linux machine the long data type is 64 bits.

      Unfortunately this is not true on Windows long is still 32 bits which means that even on a 64 bit Windows machine there is no standard 64 bit type that you can use. There are often platform specific types, like __int64 butthese are strictly non-portable.

      Comment

      • RedSon
        Recognized Expert Expert
        • Jan 2007
        • 4980

        #4
        Originally posted by Banfa
        On a 64 bit Linux machine the long data type is 64 bits.

        Unfortunately this is not true on Windows long is still 32 bits which means that even on a 64 bit Windows machine there is no standard 64 bit type that you can use. There are often platform specific types, like __int64 butthese are strictly non-portable.
        Ninja ' d

        Comment

        • donbock
          Recognized Expert Top Contributor
          • Mar 2008
          • 2427

          #5
          Standard C syntax does not provide any way to alter the size of the int type. It is what it is; and what it is can vary from one compiler to another.

          As I recall, the Standard requires int to be no smaller than short and no bigger than long. It also mandates that short be at least 16 bits and long be at least 32 bits; but either is allowed to be larger than that as long as short is less than or equal to long.

          C99 introduced the long long type, which is required to be at least 64 bits; and which must be greater than or equal to long. The C++ Standard does not mention long long, but it might be available in your compiler as a nonportable extension.

          It is not inconceivable that your particular compiler has command line options that affect the sizes of the integer types. Command line options are outside the scope of the Standard. You will have to check your compiler documentation.

          Comment

          Working...