-
Notifications
You must be signed in to change notification settings - Fork 626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should we use compound literal syntax? #14
Comments
My vote: yes. Reason: it's a useful part of the language. |
I would say use it for your own structs or third-party ones without helper functions/macros only. I think the (semi-)official Apple line is to use the CGGeometry functions for creating and accessing |
I prefer |
+1 |
+1 on using the Apple provided geometry functions. Also if you ever use blah = (CGRect){...} you immediately start a comment war on "what if Apple changes the CGRect underlying structure one day?" |
+1 |
+1 on always using the geometry functions, as per the documentation |
While tech editing i7t I realised we have an inconsistency with some people using compound literal syntax:
Should we use this less-often used, yet highly useful syntax? Or use the
CGRectMake
macro for simplicity / familiarity?My gut feeling is that we should use this feature, but ensure that the code style guidelines are easily discovered by reader (i.e. linked to by every tutorial), and that we make one goal of the style guideline to be educating the reader.
The text was updated successfully, but these errors were encountered: