• 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: is this a bug in my code or Xcode?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: is this a bug in my code or Xcode?


  • Subject: Re: is this a bug in my code or Xcode?
  • From: "Glenn L. Austin" <email@hidden>
  • Date: Sun, 23 Mar 2008 18:09:50 -0700

On Mar 23, 2008, at 6:00 PM, Roland Silver wrote:

I have a function, markCompare, which calls another, markDuration, to get a double which it assigns to the variable duration1.


static int markCompare(Mark *mark1, Mark *mark2) {

...

/**/NSLog(@"markCompare calls markDuration...");
double duration1 = markDuration(mark1);
/**/NSLog(@"...which returns a value %0.2f which markCompare assigns to duration1", duration1);

...

}


double markDuration(Mark *mark) {

...

/**/ NSLog(@"markDuration returning duration = %0.2f", duration);

return duration;

}  //end markDuration


As you can see from the following NSLogs, markDuration returns 0.25, but markCompare receives the value 0.00 from it, which it assigns to duration1.


2008-03-23 18:53:13.889 AttonalComposer[6227:813] markCompare calls markDuration...

2008-03-23 18:53:21.101 AttonalComposer[6227:813] markDuration returning duration = 0.25

2008-03-23 18:53:26.591 AttonalComposer[6227:813] ...which returns a value 0.00 which markCompare assigns to duration1


Is this a bug in my code -- or in Xcode?


Do you have a prototype of markDuration that returns a double prior to calling it from markCompare?

If not, then the call to markDuration may be getting truncated to an integer, then being converted to a double to be stored in duration1.

-Glenn
 _______________________________________________
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

  • Follow-Ups:
    • Re: is this a bug in my code or Xcode?
      • From: Roland Silver <email@hidden>
References: 
 >is this a bug in my code or Xcode? (From: Roland Silver <email@hidden>)

  • Prev by Date: is this a bug in my code or Xcode?
  • Next by Date: Re: is this a bug in my code or Xcode?
  • Previous by thread: is this a bug in my code or Xcode?
  • Next by thread: Re: is this a bug in my code or Xcode?
  • Index(es):
    • Date
    • Thread