• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Very strange problem, static strings related
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Very strange problem, static strings related


  • Subject: Re: Very strange problem, static strings related
  • From: Igor Delovski <email@hidden>
  • Date: Thu, 27 Sep 2012 20:05:15 -0700 (PDT)

Well,

As I got this message from the list, it became "someone else's problem" and as I read it, the string "912" became obviously Sptember of this year and then I found the problem in a second. A function like this:

void Something (..., char *aDate, ...)
{
   if (!aDate[0])
      strcpy (aDate, GetMeMonthYear());
   ...
}

And it was called like this: Something (..., "", ...);

Sorry to bother you all with nothing.

--- On Fri, 9/28/12, Igor Delovski <email@hidden> wrote:

From: Igor Delovski <email@hidden>
Subject: Very strange problem, static strings related
To: "xcode-users list" <email@hidden>
Date: Friday, September 28, 2012, 3:57 AM

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?
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Very strange problem, static strings related (From: Igor Delovski <email@hidden>)

  • Prev by Date: Re: Xcode suddenly won't reveal stuff in the Finder
  • Next by Date: Re: Xcode suddenly won't reveal stuff in the Finder
  • Previous by thread: Very strange problem, static strings related
  • Next by thread: Xcode suddenly won't reveal stuff in the Finder
  • Index(es):
    • Date
    • Thread