discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Warning with clang, error with gcc : attached files


From: David Chisnall
Subject: Re: Warning with clang, error with gcc : attached files
Date: Tue, 30 Apr 2019 17:33:22 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 30/04/2019 15:34, Bertrand Dekoninck wrote:
OK, thanks for your quick answer. I don't see any either, but I could try to modify NSButtonCell.h locally to have this method public. Maybe I need more help.

Normally, the fix for this kind of thing is to declare a category on NSButtonCell that exposes the method that you want. It's somewhat fragile, so best practice would be to have a dynamic check in your +initialize that checks that the method does exist.

Netherletheless, it doesn't explain why clang don't throw an error here. And I've got several warnings of this kind when compiling rik.theme. I suspect this is'nt the only private method that has be used is the rest of the code.

Clang doesn't give an error because it's well-defined behaviour: the method will be assumed to return id and will be called assuming all parameters are of type id, unless otherwise specified. That's almost certainly wrong, which is why it's a warning.

In ARC mode, this is explicitly a failure (even if the calling convention is correct, the memory ownership semantics are unknown) and this is one of the many reasons why anyone using Objective-C in 2019 should be using ARC for almost everything.

David



reply via email to

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