Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
so i'm doing some beginner code stuff with NSLog() function and i've noticed something particular:

Code:
int main()
{
	int x = 8;
	float y = 10.5;
	float z = x * y;
    NSLog (@"iMac calculates that %d * %.1f = %.0f", x, y, z);
	return 10000;
}

log returns:

Code:
2008-05-26 05:46:04.041 nothing[1672:10b] iMac calculates that 8 * 10.5 = 84

The Debugger has exited with status 16.The Debugger has exited with status 16.

so why does "return 10,000;" exit with status 16? and "return 112541233;" exit with status 49? etc?
 

Palad1

macrumors 6502a
Feb 24, 2004
647
0
London, UK
10000 decimal is also 0x2710

I think the return code is bitmasked with 0x00FF, 0x00FF being the 'user' part of the return code. Hence the exit code of 16. [0x10]

Cheers,
Palad1
 

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
Eh? I was asking a question in the hopes of trying to help. No need to get defensive about it.

sorry, i've been up all night... i was just curious to be honest, i knew i wasn't suppose to write "return 10000", i just did, and put other numbers in and it gave strange results...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.