[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [objc-improvements] Just remembered something about multiple method

From: David Ayers
Subject: Re: [objc-improvements] Just remembered something about multiple method signatures...
Date: Tue, 09 Sep 2003 13:39:15 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030507

Ziemowit Laski wrote:

On Monday, Sep 8, 2003, at 03:44 US/Pacific, David Ayers wrote:

Ziemowit Laski wrote:

On Saturday, Sep 6, 2003, at 00:54 US/Pacific, David Ayers wrote:

So now we need compiler logic to distinguish "conflicting" prototypes from "incompatible" ones. Are you offering to write it (and explain it to end-users)? :-)

Yes, see my upcomming mail...

But the new IMP promotion for id typed receivers will promote them to doubles and clobber not only of the float but all following arguments as well

I absolutely agree with you in that using the IMP prototype can also result in "bad" (i.e., unintended) codegen.

The 'IMP' assumption *will* result in "bad" code generation as soon as either return type or arguments contain floats. There is absolutly no ambiguity in that.

Don't follow you here.  Why?

In the case of vardic function (...), the callers argument will be promoted to different types according to certain promotion rules. Arguments of the 'float' type will get promoted to the 'double' type. So the implementation must expect a 'double'. Hardly any (if any at all) of the OpenStep methods expect 'doubles'. What happens in this case is that the caller will put the value as a 'double' value on the stack, but the method will only retrieve the first half of that value and interpret it as a 'float'. If there are further arguments (like in my example the integer) the called method will interpret the second half of the 'double' as the 'int' argument and ignore the actual 'int'.

Also the -compare: example is a real example that will break on architectures where 'id' is not the same size of small enums. The IMP assumption is unacceptable.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]