This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: a bit of rearranging?
On Thu, May 16, 2002 at 10:55:02PM +0200, Gabriel Dos Reis wrote:
> Nathan Myers <ncm-nospam@cantrip.org> writes:
>
> | If every time you touched a class definition, you re-arranged it to
> | match as closely as possible the ordering
> |
> | typedefs
> | public constructors and destructor
> | public member functions
> |
> | protected constructors
> | protected member functions
> | overriding virtuals
> |
> | friend declarations.
> | private member functions
> | private member data
> |
> | you would be improving the library each time.
>
> I second this scheme. Actually, I think every inline member functions
> (perhaps with very few exceptions) should be defined out-of-class.
I used to agree, but after some more experience my coding standard
now dictates that only one-line inlines may appear in class bodies
(and no cheating by piling up statements on a line!).
Making inlines less temptingly convenient to write is a Good Thing,
but a blanket prohibition risks rebellion. People can live with
a one-line restriction. In fact, it makes headers more readable
than the more-restrictive alternative, because almost all the
inlines are self-documenting.
I wonder if it wouldn't be a Good Thing to make doxygen slurp up
and display the one-line inlines.
Nathan Myers
ncm at cantrip dot org