How would you find the maximum long
value supported on your system within an application in Objective-C? That is, how do we determine what the largest value is that long
can represent?
Asked
Active
Viewed 5,872 times
3

Brad Larson
- 170,088
- 45
- 397
- 571

Justin Galzic
- 3,951
- 6
- 28
- 39
2 Answers
14
As in C: include limits.h, and look at LONG_MAX or INT_MAX.

Martin v. Löwis
- 124,830
- 17
- 198
- 235
-
This was it. But for objective-c, no needed to add the include file. This SO question answered it all: http://stackoverflow.com/questions/2107544/types-in-objective-c-on-iphone – Justin Galzic Dec 08 '10 at 15:59
-10
public class Main
{
public void displayMinAndMaxValuesOfLong()
{
System.out.println(Long.MIN_VALUE);
System.out.println(Long.MAX_VALUE);
}
public static void main(String[] args)
{
new Main().displayMinAndMaxValuesOfLong();
}
}
-
2-1 not only is this the wrong language but I had to correct the formatting of the code. – JeremyP Dec 08 '10 at 09:24
-
It's also just plain weird code. Why would you instantiate Main in main() and call an instance method for this? – Chuck Dec 08 '10 at 09:29