[webkit-dev] unwritten rules of webkit style
simon.fraser at apple.com
Wed Sep 2 10:36:01 PDT 2009
On Sep 2, 2009, at 9:59 AM, Yong Li wrote:
> I think global variables should start with "g_".
I actually agree fairly strongly that constants and global/static
variables should have consistent, identifiable prefixes.
For globals, having a prefix code easier to understand with a quick
scan. If the global has no prefix, you have to search for it and
discover that it's not a local variable, member variable or parameter
before understanding where it comes from. This is a particular problem
in Xcode, which does not use a different syntax highlight color for
globals (unlike the venerable CodeWarrior). I also think that globals
are a particular concern because they impact thread safety, and
misunderstanding their scope of influence can have bad ramifications.
Using a prefix for constants also reduces brainprint when scanning
code; you know that its value is never going to change.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-dev