Boost logo

Boost :

From: Paul A Bristow (pbristow_at_[hidden])
Date: 2008-04-14 05:26:24


>-----Original Message-----
>From: boost-bounces_at_[hidden]
>[mailto:boost-bounces_at_[hidden]] On Behalf Of Maciej Sobczak
>Sent: 14 April 2008 08:25
>To: boost_at_[hidden]
>Subject: [boost] Enum naming conventions
>Is there an established naming convention for enum names in Boost?
>I don't see anything truly consistent.
>Consider this:
>enum eGrays { eBlack, eDarkGray, eGray, eLightGray, eWhite };
>Is this commonly accepted by the Boost community?
>If not, what alternative naming for the above would you propose?

Jake Voytko faced a similar, but more complicated difficulty with naming SVG colors

  // -----------------------------------------------------------------
  // Deals with colors that have special names. The reason that the
  // underscore separator convention does not match the normal Boost format
  // is that these names that are specified by the SVG standard.
  // tan is also renamed to tanned to avoid clash with function tan in math.h
  // -----------------------------------------------------------------
  enum svg_color_constant
    aliceblue, antiquewhite, aqua, aquamarine, azure, beige,
    bisque, black, blanchedalmond, blue, blueviolet, brown,
<... snipped>
    skyblue, slateblue, slategray, slategrey, snow, springgreen,
<and things got worse when we got to tan!
    // tan,
 // Note that tan would clash with geometric tan in math.h!
global names are evil!
 tanned, teal, thistle, tomato, turquoise, violet,

I don't think Boost have even *banned* camel mode - just deprecated it.


  enum grays { gray_black, gray_dark, gray, gray_light...}


  enum grays {black_gray, dark_gray, gray_gray, light_gray...}

would both seem only a little longer and *much* easier to read?

Or is it a stronger 'this is an enum' marker that you are trying to achieve?


Paul A Bristow
Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB
+44 1539561830 & SMS, Mobile +44 7714 330204 & SMS

Boost list run by bdawes at, gregod at, cpdaniel at, john at