• 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
wrong value for LONG_MAX (9223372036854775807 rather than 2147483647) on macintosh 10.6 ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

wrong value for LONG_MAX (9223372036854775807 rather than 2147483647) on macintosh 10.6 ?


  • Subject: wrong value for LONG_MAX (9223372036854775807 rather than 2147483647) on macintosh 10.6 ?
  • From: CSights <email@hidden>
  • Date: Thu, 3 Dec 2009 19:11:15 -0500

Hi,
	It appears that on macintosh 10.6 LONG_MAX has the same value as LLONG_MAX
(both are 9223372036854775807).
	According to http://home.att.net/~jackklein/c/inttypes.html#problems
LONG_MAX should be 2147483647.
	Some version info:
$ g++ --version
i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646) (dot 1)
$ uname -a
Darwin xxxxxxxxxxxxxxxxxxxxxx 10.2.0 Darwin Kernel Version 10.2.0:
Tue Nov  3 10:37:10 PST 2009; root:xnu-1486.2.11~1/RELEASE_I386 i386

Below is a program that demonstrates this:

$ cat long_max.cpp
#include <iostream>
#include <climits>

int main()
{
        std::cout << "LONG_MIN="<<LONG_MIN<<"\n";
        std::cout << "LONG_MAX="<<LONG_MAX<<"\n";
        std::cout << "LLONG_MIN="<<LLONG_MIN<<"\n";
        std::cout << "LLONG_MAX="<<LLONG_MAX<<"\n";
}

$ ./a.out
LONG_MIN=-9223372036854775808
LONG_MAX=9223372036854775807
LLONG_MIN=-9223372036854775808
LLONG_MAX=9223372036854775807

Is this right?
	C.




 _______________________________________________
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

  • Follow-Ups:
    • Re: wrong value for LONG_MAX (9223372036854775807 rather than 2147483647) on macintosh 10.6 ?
      • From: Clark Cox <email@hidden>
    • Re: wrong value for LONG_MAX (9223372036854775807 rather than 2147483647) on macintosh 10.6 ?
      • From: "Sean McBride" <email@hidden>
    • Re: wrong value for LONG_MAX (9223372036854775807 rather than 2147483647) on macintosh 10.6 ?
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Run -> Fix with x86_64 in Xcode 3.2.1 64-bit
  • Next by Date: Re: wrong value for LONG_MAX (9223372036854775807 rather than 2147483647) on macintosh 10.6 ?
  • Previous by thread: Run -> Fix with x86_64 in Xcode 3.2.1 64-bit
  • Next by thread: Re: wrong value for LONG_MAX (9223372036854775807 rather than 2147483647) on macintosh 10.6 ?
  • Index(es):
    • Date
    • Thread