GNU的C++代码书写规范,C语言之父Dennis Ritchie亲自修订(1)C++ Standard Library Style Guidelines DRAFT 1999-02-26 -------------------------------------
This library is written to appropriate C++ coding standards. As sUCh, it is intended to precede the recommendations of the GNU Coding Standard, which can be referenced here:
http://www.gnu.ai.mit.edu/prep/standards_toc.html
ChangeLog entries for member functions should use the classname::member function name syntax as follows:
1999-04-15 Dennis Ritchie <dr@att.com>
* src/basic_file.cc (__basic_file::open): Fix thinko in _G_HAVE_IO_FILE_OPEN bits.
Notable areas of divergence from what may be previous local practice (particularly for GNU C) include:
01. Pointers and references char* p = "flop"; char& c = *p; -NOT- char *p = "flop"; // wrong char &c = *p; // wrong
Reason: In C++, definitions are mixed with executable code. Here, p is being initialized, not *p. This is near-universal practice among C++ programmers; it is normal for C hackers to switch spontaneously as they gain eXPerience.