r180860 - [ObjC declaration documentation] declaration of

John McCall rjmccall at apple.com
Wed May 1 12:00:14 PDT 2013


On May 1, 2013, at 11:57 AM, jahanian <fjahanian at apple.com> wrote:
> On May 1, 2013, at 11:54 AM, Jordan Rose <jordan_rose at apple.com> wrote:
>> On May 1, 2013, at 11:51 , John McCall <rjmccall at apple.com> wrote:
>>> On May 1, 2013, at 10:55 AM, Jordan Rose <jordan_rose at apple.com> wrote:
>>>> I'm not sure it's right to remove 'const'—consider global string constant declarations:
>>>> 
>>>> extern NSString * const MyNotificationName;
>>>> 
>>>> I think you'll have to explicitly remove ObjC lifetime attrs only.
>>> 
>>> Why is this a problem?  You think the user wants to see "cannot initialize object of type 'NSMutableString *' with expression of type 'NSString * const'"?
>>> 
>>> As long as the value's been lvalue-to-rvalue-converted, I see no reason to report top-level qualification.
>> 
>> Hm, point. I didn't realized this was just for rvalues. Thanks for the explanation.
> 
> Yes, but when we are providing documentation, we want to preserve the ‘const’- ness:
> 
> @interface NSMutableArray : NSArray 
> {
> //! This is the name.
>   NSString *const Name;
> }
> //! This is initWithLabel comment.
> - (NSString *)initWithLabel:(NSString * const)label;
> @end

I'm not sure what you mean by "providing documentation".  The 'const' qualifier here is meaningless.  If this were a method definition, it would prevent assignment to 'label'; but it isn't a method definition, so it does nothing.

John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130501/2d310ad2/attachment.html>


More information about the cfe-commits mailing list