blob: e16bb8ff63024a37a2acbce7ef07f5956702ab1c [file] [log] [blame] [view]
Mark Cogan6a8e48782017-08-17 10:06:241## All files are Objective-C++
2
3Chrome back-end code is all C++ and we want to leverage many C++ features, such
4as stack-based classes and namespaces. As a result, all front-end Bling files
5should be .mm files, as we expect eventually they will contain C++ code or
6language features.
7
Mark Cogan6a8e48782017-08-17 10:06:248## Use ObjCCast<T> and ObjcCCastStrict<T>
9
10As the C++ style guide tells you, we never use C casts and prefer
11`static_cast<T>` and `dynamic_cast<T>`. However, for Objective-C casts we have
Avi Drissmaneac566b02023-08-18 02:56:2112two specific casts: `base::apple::ObjCCast<T>arg` is similar to `dynamic_cast<T>`,
Mark Cogan6a8e48782017-08-17 10:06:2413and `ObjcCCastStrict` `DCHECKs` against that class.
14
15## Blocks
16
17We follow Google style for blocks, except that historically we have used 2-space
18indentation for blocks that are parameters, rather than 4. You may continue to
19use this style when it is consistent with the surrounding code.
20
21## NOTIMPLEMENTED and NOTREACHED logging macros
22
23`NOTREACHED`: This function should not be called. If it is, we have a problem
24somewhere else.
25`NOTIMPLEMENTED`: This isn't implemented because we don't use it yet. If it's
26called, then we need to figure out what it should do.
27
Solomon Kinard57aa4ef2023-03-22 15:18:2428When something is called but doesn't need an implementation, just add a comment
29indicating this instead of using a logging macro.
Mark Cogan6a8e48782017-08-17 10:06:2430
31## TODO comments
32
33Sometimes we include TODO comments in code. Generally we follow
34[C++ style](https://google.github.io/styleguide/cppguide.html#TODO_Comments),
35but here are some more specific practices we've agreed upon as a team:
36
37* **Every TODO must have a bug**
38* Bug should be labeled with **Hotlist-TODO-iOS**
39* Always list bug in parentheses following "TODO"
40 * `// TODO(crbug.com/######): Something that needs doing.`
41 * Do NOT include http://
42* Optionally include a username for reference
43* Optionally include expiration date (make sure it's documented in the bug!)