discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Possible MacOS X compier problem


From: David Ayers
Subject: Re: Possible MacOS X compier problem
Date: Thu, 24 Jul 2003 10:11:34 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030507

Bill Northcott wrote:

There are several rearrangements of the code, similar to your suggestion that work. There are others that don't. In a previous message I put up a long list of variations on another line, some of which worked and some of which did not. Completely unnesting always seems to work. They all work using the FSF compiler. However, there are other more subtle problems in the finished code, so I am trying to get to the bottom of this one easily reproducable issue in the hope it might reveal the error in the compiler.

Maybe you could post the full implmenetation of the setQuotedObject: method and it's declaration in the coresponding header file. I'm starting to believe that you're a victim of a change in convention from the pre OpenStep days. Back in the early days, methods were supposed to always return self, unless they had other meaningful values to return. Therefor an unspecified signature in the header:

-setSomeValue:value;

impliied

- (id)setSomeValue:(id)value;

so that the type of nesting you code example uses could work. I believe this is no longer the case (I must admit that I don't knowingly use such code, so I'm not sure how the the compiler currently acts) Instead the header may currently imply:

- (void)setSomeValue:(id)value;

Now, if that is the case and your implementation of -setSomeValue: actually ends in a:

return self;

but the caller didn't prepare the stack receive the return value (because the header didn't expicitly state that the method will return an id), you will have undefined behavior.

I really doubt this is a compiler error. Maybe Apple tweaked thier compiler to somehow support the legacy interpretation, and maybe only under certain conditions. I don't know. But I would consider it invalid code. You could fix it, by making the method signatures explicit. You can of course write to gcc-bugs and see what they say.

But all of this is based on the theory that the code doesn't use explicit method signatures, so more information would be helpful.

Cheers,
David








reply via email to

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