Seems like Xcode is intermittently ignoring my new code


On page 43, when I change from

int x = 255;
printf("x is %d.\n", x);


int x = 255;
printf("x is %d.\n", x);
printf("In octal, x is %o.\n", x);
printf("In hex, x is %x.\n", x);

and click Run, I only get the result

I didn’t know what happened to the result

In octal, x is 377. In hexadecimal, x is ff.

I selected the additional lines, pressed Command-X to Cut the lines, clicked Run, then pressed Command-V to Paste the lines back in, and clicked Run again. And then I saw the expected results.

I thought I was crazy and just thought I clicked Run, until I experienced something similar in chapter 7 when I ran the first “Aaron is cool” loop, and only got the result

I changed “int i = 0” to “int i = 5”, clicked Run, and got my expected results.
Then I changed it back to “int i = 0”, clicked Run, and got my expected results.

What’s going on? Is Xcode going to slowly drive me insane? Should I bail out now?
Do I need to Save before I click Run?


The current Xcode documentation appears to be incorrect; it states that the automatic save behavior is configurable under the General tab in Xcode preferences.

You might, however, try the Reset “Don’t Ask Me” Warnings button there and see if it prompts you for a save next time you try to build or run.


Yeah, that used to be a setting you could click, but now I don’t see it. Not sure if that’s an effect of Xcode 4.2, Lion, or a combination of both.