• 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: App hangs when displaying any sheet in 10.5 [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: App hangs when displaying any sheet in 10.5 [SOLVED]


  • Subject: Re: App hangs when displaying any sheet in 10.5 [SOLVED]
  • From: Brian Stern <email@hidden>
  • Date: Fri, 6 Jun 2008 03:01:53 -0400


On Jun 6, 2008, at 1:58 AM, Graham Cox wrote:

I agree, the compiler ought to be able to use the return type to disambiguate two otherwise identically named methods (or warn of the mismatch) - but it clearly doesn't.

My experimentation reveals, with the Xcode 2.5 tools, that the return type of the first method in scope is used. That is, given two methods in two different classes with the same names and different return types the one that comes first in the compilation unit rules the expected return type when sending the specified message to an id variable.


Also, if code attempts to send a message to an id variable and that message isn't in scope then warnings are issued and an assumption that the message returns a type of id and takes varargs is used.

It seems almost certain that you had a 'position' method that returned an integer type in scope somehow otherwise you either would have gotten a warning or the code would have correctly expected a float.

Having said that, I can see why the code wouldn't work correctly but I don't really know why it would result in memory corruption. Possibly it's in the position method or in objc_msgSend, which was called incorrectly instead of objc_msgSend_fpret.


On 6 Jun 2008, at 3:37 pm, Hamish Allan wrote:

On Fri, Jun 6, 2008 at 6:26 AM, Graham Cox <email@hidden> wrote:

I guess the question is, given an object type 'id', which method signature
will the compiler go with? Does the return type affect the method signature?
(In C++ it doesn't for example), so two methods:


- (CGPoint) position;
- (float)   position;

might well have identical signatures. The compiler doesn't have an object
type to narrow it down, so which will it use - the first it finds maybe.

I'd have thought that in the case:

// id anonymous
float f = [anonymous position];

the compiler ought to assume that the method being used is the one
returning a float, or if not at least warn about an implicit cast from
CGPoint to float. Perhaps if it were -(int)position rather than
-(CGPoint)position, you might not expect a warning, but in that case
you would expect a cast, so it shouldn't break.


However, that does appear to be what is happening. In the absence of
any other explanation, I'd call it a compiler bug.

Hamish

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Where to start looking to fix hang? (From: Graham Cox <email@hidden>)
 >Re: Where to start looking to fix hang? (From: j o a r <email@hidden>)
 >App hangs when displaying any sheet in 10.5 [was Re: Where to start looking to fix hang?] (From: Graham Cox <email@hidden>)
 >Re: App hangs when displaying any sheet in 10.5 [was Re: Where to start looking to fix hang?] (From: Graham Cox <email@hidden>)
 >Re: App hangs when displaying any sheet in 10.5 [was Re: Where to start looking to fix hang?] (From: Andy Lee <email@hidden>)
 >Re: App hangs when displaying any sheet in 10.5 [SOLVED] (From: Graham Cox <email@hidden>)
 >Re: App hangs when displaying any sheet in 10.5 [SOLVED] (From: Brian Stern <email@hidden>)
 >Re: App hangs when displaying any sheet in 10.5 [SOLVED] (From: "Hamish Allan" <email@hidden>)
 >Re: App hangs when displaying any sheet in 10.5 [SOLVED] (From: Graham Cox <email@hidden>)
 >Re: App hangs when displaying any sheet in 10.5 [SOLVED] (From: "Hamish Allan" <email@hidden>)
 >Re: App hangs when displaying any sheet in 10.5 [SOLVED] (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: DTrace probe problem
  • Next by Date: Regular Expressions?
  • Previous by thread: Re: App hangs when displaying any sheet in 10.5 [SOLVED]
  • Next by thread: Re: App hangs when displaying any sheet in 10.5 [SOLVED]
  • Index(es):
    • Date
    • Thread