-- Using a prefix for constants also reduces brainprint when scanning code; you 
know that its value is never going to change.

I agree. c_xxx might look ugly, but it is even more helpful for making the code 
readable than other coding rules.

-Yong
  ----- Original Message ----- 
  From: Simon Fraser 
  To: Yong Li 
  Cc: David Levin ; WebKit Development 
  Sent: Wednesday, September 02, 2009 1:36 PM
  Subject: Re: [webkit-dev] unwritten rules of webkit style


  On Sep 2, 2009, at 9:59 AM, Yong Li wrote:


    I think global variables should start with "g_".

    -Yong


  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.


  Simon

_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to