• 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: Problem using static floats
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem using static floats


  • Subject: Re: Problem using static floats
  • From: Scott F Bayes <email@hidden>
  • Date: Thu, 19 Jul 2007 19:13:44 +0900

Hi Joel,

I saw something somewhat similar a few days ago and submitted a bug report. No response yet. 10.4.10 on an original MacBook, latest Xcode, stock standard.

In my case, passing a float into an Obj-C instance method failed. Just before the method call, the debugger showed the expected value in my float variable. On the other side, inside the method, the incoming float argument was essentially a random number. When I changed to a double, it worked fine. So did an int.

I was able to switch to doubles to work around it. I could also have used my own fixed-point convention with ints, since the dynamic range was small and only 3 sig fig were needed anyway.


Scott Bayes

On Jul 19, 2007, at 14:09 , Joel Norvell wrote:

I recently switched from a PowerBook G4 to a Macbook Pro. I’m currently using
Mac OS 10.4.10 and Xcode 2.4.1 (from the Macbook Pro DVDs).


I’m using some static class variables to communicate between classes in a Cocoa
project.


    // I do this in MyDocument.m

    [MyWidget setPages:[self pages]];
    [MyWidget setPageHeight:[self pageHeight]];

    // These snippets are from MyWidget.m

    static int             pages;
    static float           pageHeight;

+ (float) getPageHeight { return pageHeight;}
+ (void) setPageHeight:(float) theHeight { pageHeight = theHeight; }


I can see that the float value is not passed correctly into MyWidget but the
int value is. (Both worked correctly on the PowerBook.) I think this may be a
byte ordering problem in floats. Is there an X-code setting that affects this?



I realize this is a broad question. I’m hoping someone else has seen this
problem and knows the fix!


Thanks,
Joel



______________________________________________________________________ ______________
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.
http://mobile.yahoo.com/go?refer=1GNXIC
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40kdn.biglobe.ne.jp


This email sent to email@hidden


_______________________________________________ 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: Problem using static floats
      • From: "Shawn Erickson" <email@hidden>
References: 
 >Problem using static floats (From: Joel Norvell <email@hidden>)

  • Prev by Date: Re: Problem using static floats
  • Next by Date: Suggestion: Watch your language and localizations with Xcode
  • Previous by thread: Re: Problem using static floats
  • Next by thread: Re: Problem using static floats
  • Index(es):
    • Date
    • Thread