News for hackers. Stuff that matters.
Re:Google C++ Style Guide by _delirium on Sunday February 20, 2011 @03:09PM (#2242865)
Huh, I don't think I've seen this constant naming convention before:

   const int kDaysInAWeek = 7;
Re:Google C++ Style Guide by Xuzz on Sunday February 20, 2011 @03:24PM (#2242918)
It's also used by Apple in all of their Cocoa and CoreFoundation code. An example from CoreFoundation would be their constant CFAllocator references:

    const CFAllocatorRef kCFAllocatorDefault;
    const CFAllocatorRef kCFAllocatorSystemDefault;
    const CFAllocatorRef kCFAllocatorMalloc;
    const CFAllocatorRef kCFAllocatorMallocZone;
    const CFAllocatorRef kCFAllocatorNull;
    const CFAllocatorRef kCFAllocatorUseContext;
Re:Google C++ Style Guide by jparise on Sunday February 20, 2011 @03:20PM (#2242901)
We used that C++ constant naming convention at EA, too. I like it because it nicely differentiates C++ typed constants from preprocessor constants and macros (which we SPELLED_THUSLY).
Re:Google C++ Style Guide by _delirium on Monday February 21, 2011 @09:35AM (#2245517)
Yeah, it appears it's actually quite common, and I must be one of the last people to be surprised by it. =] I've never been part of a major multi-person C++ project, though, so my stylistic conventions are a mixture of C conventions and the conventions used in the STL. I tend to SPELL_THUSLY even C++ typed constants, though I have also seen them PascalCased (but then, unless context makes it sufficiently clear, they can look like class names).
Re:Google C++ Style Guide by uytghjhgf on Sunday February 20, 2011 @11:27PM (#2244265)
And useful if the number of days in a week ever changes.
Re:Google C++ Style Guide by phatbyte on Sunday February 20, 2011 @04:15PM (#2243106)
I'm actually learning C and I see it a lot in the book examples regarding macros(#define ....)