Not sure if right place, but I suppose that here is the place with a greatest number of people that could help me.
Some static strings in my project become something else as they get passed to functions. What makes this a mystery it's a fact that the project in question is a classic mac & carbon project and I have similar problem, but with different strings at two different places, but in the same source file.
So it is a very old project, changes sporadicly, 200 C files, as many H files, 800 K of classic resources. I had to change only one thing when I noticed something
strange. I was in Xcode 3.2.6, SDK 10.4.
A call like this SomeFunction ("01"); received "912" string. Several times in debugger, but it always the same "912" string inside of SomeFunction(). Restarts, rebuilds. Same values again and again. Aside from that, I couldn't notice anything else that wasn't right. No crashes, no freezes, everything works as it should.
Then I moved to my old G4 and CodeWarrior to check the same thing and it worked well, the function in question gets "01" string, but then I noticed something else, in the same source file that was behaving crazy in Xcode.
if (strcmp(blah, "21")) { DoOneThing (); } else DoSomethingElse();
I was expecting SomethingElse, but the first DoOneThing() was being executed, even though variable blah was "21" as seen in debugger. So, in the same source file, different platform, different compiler, static strings behave like I'm the Twilight Zone. Nothing
else was wrong as I could observe in few hours as I was playing with my application.
I just wanted to change one little detail and then I wasted a day on this without any result. I have found the OSX version from two month ago when I did the previous change and it behaves the same, only no one noticed back then.
Is there any logical explanation to this? Do I have too many static strings for a carbon project? How can I examine the executable file to see how big are segments of it? |