|
Boost : |
From: Guillaume Melquiond (gmelquio_at_[hidden])
Date: 2002-10-23 13:45:00
On Wed, 23 Oct 2002, Fernando Cacciola wrote:
> > Or should it be the Interval library convention that puts the constant
> > name first - an obvious plus point when making ordered lists - all the
> > pi constants will come together.
> >
> > [details snipped]
> >
> FWIW, my own constants use *exactly* (word by word I think) the naming
> convention you proposed.
Would it be surprising if I said I prefer the way the constants in
the Interval library are named? :)
More seriously, I prefer using a sort of Polish inverse notation in order
to have the main term in front of the name. For example, I think it's more
homogeneous to have
pi_half
pi_twice
rather than
half_pi
two_pi
> > And while I am seeking views on names, do the following seem sensible:
> >
> > Explicit typed names
> >
> > pi_f // float
> > pi_d // double
> > pi_l // long double or pi_l ??
> > // Potential ambiguity of long int and long double here!
> > // C standard ISO 9899:1999 (a.k.a. C99) choses _l for long double
> > pi_i // integer
> > pi_li // long integer // or pi_l conflists with C99 ??
> >
> What about unsigned constants?
Does that exist? The only unsigned constants that I can think of are the
upper limits of the unsigned integral types. And I don't think the
Constants library has to provide them.
> I'd rather use a 'type + (optional) modifier' postfix scheme:
>
> type:
> f=floating point
> i=integral
>
> modifiers:
> s=short
> l=long
> u=unsigned
>
> pi_fs (float)
> pi_f (double)
> pi_fl (long double)
> pi_i (int)
> pi_il (long int)
> pi_iu (unsigned int)
If you already have 'pi_i', there is no need for 'pi_iu', is it?
> > Interval limit static const constant variable names - add _l and _u
> >
> These will be easely confused with the 'type' postfix.
> I'd use prefix instead:
>
> lower_pi_fl
> higher_pi_fl
I don't know if it's better to have long name. But I'm sure I wouldn't go
for a prefix notation. And I would also use suffixes with the same length:
pi_fl_lower
pi_fl_upper
or
pi_lower_fl
pi_upper_fl
Please note that 'lower' and 'upper' are the words used to refer to the
bounds of an interval in the Interval library and I think it wouldn't be a
bad idea to use the same notation in the two libraries.
Regards,
Guillaume
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk