Академический Документы
Профессиональный Документы
Культура Документы
-------------------------------------
http://www.gnu.ai.mit.edu/prep/standards_toc.html
06. enumerators
enum
{
space = _isspace,
print = _isprint,
cntrl = _iscntrl,
};
-not-
enum { space = _isspace, print = _isprint, cntrl = _iscntrl };
gribble::gribble()
: _m_private_data(0), _m_more_stuff(0), _m_helper(0);
{ }
-not-
gribble::gribble() : _m_private_data(0), _m_more_stuff(0), _m_helper(0);
{ }
virtual int
foo()
-not-
virtual int foo()
this->sync()
-not-
sync()
the library currently has a mixture of gnu-c and modern c++ coding
styles. the gnu c usages will be combed out gradually.
name patterns:
don't use names in the same scope that differ only in the prefix,
e.g. _s_top and _m_top. see badnames for a list of forbidden names.
(the most tempting of these seem to be and "_t" and "__sz".)
--------------------------
[by example]
#ifndef _header_
#define _header_ 1
namespace std
{
class gribble
{
public:
// ctor, op=, dtor
gribble() throw();
gribble(const gribble&);
explicit
gribble(int __howmany);
gribble&
operator=(const gribble&);
virtual
~gribble() throw ();
// argument
inline void
public_member(const char* __arg) const;
int
two_lines(const char* arg)
{ return strchr(arg, 'a'); }
inline int
three_lines(); // inline, but defined below.
// note indentation
template<typename _formal_argument>
void
public_template() const throw();
template<typename _iterator>
void
other_template();
private:
class _helper;
int _m_private_data;
int _m_more_stuff;
_helper* _m_helper;
int _m_private_function();
enum _enum
{
_s_one,
_s_two
};
static void
_s_initialize_library();
};
class gribble::_helper
{
int _m_stuff;
#endif /* _header_ */
namespace std {
gribble::gribble()
: _m_private_data(0), _m_more_stuff(0), _m_helper(0);
{ }
inline int
gribble::three_lines()
{
// doesn't fit in one line.
}