On Wednesday, July 3, 2019 at 2:27:30 PM UTC-7, Chris Peterson wrote:
> On 7/3/2019 11:37 AM, Bryce Seager van Dyk wrote:
> > I wanted to clarify, and discuss if needed, our styling of #define guards. 
> > My understanding is that we are now using Google's style in regards to 
> > #define guards 
> > (https://google.github.io/styleguide/cppguide.html#The__define_Guard). I 
> > believe this would mean for `dom/media/foo/bar.h` I would use a `#define 
> > DOM_MEDIA_FOO_BAR_H_` style guard.
> 
> The Google style guide says:
> 
> "The format of the symbol name should be <PROJECT>_<PATH>_<FILE>_H_. ... 
> For example, the file foo/src/bar/baz.h in project foo should have the 
> following guard: #ifndef FOO_BAR_BAZ_H_"
> 
> Would our project prefix be "MOZ_"? The #define guard for 
> dom/media/foo/bar.h would then be MOZ_DOM_MEDIA_FOO_BAR_H.

Good question. Chromium's code doesn't seem to observe the project convention 
in the media code I'm familiar with. E.g. 
https://cs.chromium.org/chromium/src/media/formats/mp4/track_run_iterator.h?l=36&rcl=fb277091ba0ccbf8b2869022910573386e33c6de
 doesn't have a CHROMIUM prefix on its guard. Other directories rooted at 
chromium/src/ also appear to not have a CHROMIUM prefix used in their guards. 
Trawling some of their other projects on github I see that some do observe the 
usage of the prefix and some do not.

I thought the non-project prefix version seemed the more intuitive mapping onto 
the mozilla-central structure. However, that's entirely my person view, and is 
almost certainly influenced by my reading of Chromium code.

I feel much more strongly about consistency than about either particular style. 
So I appreciate hearing thoughts about what seems the intuitive/appropriate 
mapping of the guidelines onto the codebase.

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to