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

Darkroom

Guest
Original poster
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?
 
so why does "return 10,000;" exit with status 16? and "return 112541233;" exit with status 49? etc?

Why are you even returning these values in the main function anyway? It should return 0 for success or if you hit some error handling code return -1 for failure.
 
Why are you even returning these values in the main function anyway? It should return 0 for success or if you hit some error handling code return -1 for failure.

right, well as i mentioned i was just curious... but thanks for asking... 🙄
 
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
 
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.