• 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: Mixing Objective C and C++
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mixing Objective C and C++


  • Subject: Re: Mixing Objective C and C++
  • From: Shawn Erickson <email@hidden>
  • Date: Tue, 25 Jan 2005 12:32:44 -0800


On Jan 25, 2005, at 11:51 AM, Bert Torfs wrote:

Hi all,

I am writing a program where the model is written in C++ (legacy), the view in Objective C and the controller something in between. Every C++ object has an objective C counterpart that acts as a pass-thru to its methods. These objects are created and released as needed. I have not touched the C++ objects until now.
For performance, I added an instance variable to every C++ object that holds its Objective C counterpart. But now simple things like

<x-tad-smaller> double theAmount;
theAmount = currentDebit->localBalance();

</x-tad-smaller>
do not work anymore. While localBalance equals 91797.283316716232, theAmount equals -6.9988350839989206e-268 after the function call.
(the method 'localBalance' does nothing but returning localBalance.).
Any idea?

Ignoring the problematic use of floating point numbers for what appears to be currency...

Are you working with serialized C++ objects that when unserialized may not reflect the changes you made to the classes when you added the references out to the Objective-C object?

Did you rebuild everything? The vtable may be screwed up and your localBalance() call may be hitting a different a different method (unlikely that link errors wouldn't have been hit but who knows if you have some type of mixed object code). Try deleting the build directory and rebuilding things.

Showing code would help...

-Shawn
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Mixing Objective C and C++
      • From: Bert Torfs <email@hidden>
References: 
 >Mixing Objective C and C++ (From: Bert Torfs <email@hidden>)

  • Prev by Date: Re: Simple question: how can I call 'pbxbuild' from the Darwin prompt (where is it?)?
  • Next by Date: Re: Another TableView question...
  • Previous by thread: Mixing Objective C and C++
  • Next by thread: Re: Mixing Objective C and C++
  • Index(es):
    • Date
    • Thread