ios - "const" In Objective-C and Cocos2D: Is It Me, Or Does It Seem To Be Taboo? -
I'm not sure this is the right place to ask, because this is not really a technical question, but a And of the question style and coding practices ...
I have always used fans to use "cons" to determine the variables that will not change in their lifetime, especially when they use functions / methods It is probably from my history that C ++ is born with , Where the object can be passed from the context instead of the pointer, but you want to make sure that the original value has not been changed by mistake, either by you or by someone else on your team Was the same code snippet
When looking at headers for general purpose and especially coco 2D, then I have noticed that the lack of use of this item is worth noting . Now, I leave'm not against developing the code as soon as possible, and the developers are leaving barriers option to modify the value of developing your code and develop, but there are some instances where I believe That it is not loose. For example, , Cocos 2D / in Uaikit, "Uaifoti Fontaethanam" method takes as a parameter the font name "(Ansstiing *)" What replace the original method of Rights Reserved Need to do that was passed in the string? I personally want to define the continuous string as the "constant" objects, and do not like the need to put these methods in the form of non-"cost" when calling them. Sufficient conversions: My question - what direction is now moving towards a less well-defined interface and the "lazy reference" (which I consider not as an abusive term) More on the side? Thanks in advance for any feedback ... const objective C class signal will not be anything because it will be aimed at is no way to mark a method as Const why it was so overloaded with confusing ways because many types as C ++, the compiler never implemented can do. He said, in my old company, we have something like: The issue is that at least no other thing can be specified again. Objectives are the nearest analog non-selected / non-convertible versions in the C / Coco / Foundation data structures, which really do not help your case.
NSString * const kMyCoolString = @ "Hello, world!";
Comments
Post a Comment