Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2004-09-10 14:06:22


From: "Jonathan Turkanis" <technews_at_[hidden]>
>
> There's one last problem. The file
> boost/io/detail/streambufs/indirect_streambufs contains this code:
>
> enum {
> f_open = 1,
> f_input_closed = f_open << 1,
> f_output_closed = f_input_closed << 1,
> f_output_buffered = f_output_closed
> };
>
> This should be
>
> enum {
> f_open = 1,
> f_input_closed = f_open << 1,
> f_output_closed = f_input_closed << 1,
> f_output_buffered = f_output_closed << 1
> };

This is a pain to read and maintain. You should write them like
this:

enum
{
   f_open = 1<<0,
   f_input_closed = 1<<1,
   f_output_closed = 1<<2,
   f_output_buffered = 1<<3
};

You can easily spot that the values are in ascending order and
you don't have to replicate the name of the preceding enumerator
(which would make reordering a pain, should that be needed).

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk