cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cjpearson <...@git.apache.org>
Subject [GitHub] cordova-ios pull request: * is a Right-to-left associative operato...
Date Fri, 26 Jun 2015 11:50:13 GMT
Github user cjpearson commented on the pull request:

    https://github.com/apache/cordova-ios/pull/145#issuecomment-115654625
  
    The current style is not incorrect or a bad habit. It may not follow Apple's style, but
both styles are valid and readable.
    
    Many C programmers choose to attach the asterisk to the variable, emphasizing syntax,
while most C++ programmers prefer to emphasize the type by attaching the asterisk to the type.
    
    Since Objective-C, like C++, is an Object Oriented language, I think it makes much more
sense to emphasize type by keeping the asterisk attached to the type.
    
    Also, there are several common situations in Objective-C where there is no variable for
you to attach the asterisk to even if you wanted.
    
    Casting
    
    `(NSString*)someObject`
    
    Method Parameters
    
    `- (void)someMethod:(NSObject*)param;`
    
    Generics
    
    `NSArray<NSString*>* someArray;`
    
    The common defense against grouping the asterisk with the type is that one might think
these two lines behave the same.
        
        int* a, b, c;
        int *a, *b, *c;
    
    I think that's a pretty easy situation to avoid. Just declare your variables on different
lines.
    
    For whatever it's worth, I vote keeping the style the way it is.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Mime
View raw message