Boost logo

Boost :

From: Gabriel Dos Reis (gdr_at_[hidden])
Date: 2003-01-12 04:49:09


Terje Slettebø <tslettebo_at_[hidden]> writes:

| >From: "Gabriel Dos Reis" <gdr_at_[hidden]>
|
| > What I find confusing about the current rule is that it makes an
| > exception for integral type const static data member. I think the old
| > rule was less irregular.
| >
| > (Strangely enought, for long time -- since the publication of TC++PL3
| > in 1997 -- I've been convinced of having read Bjarne write something
| > like "it is something I call a misfeature"; but now I'm perfectly
| > unable to locate something similar in TC++PL3 "special edition", so
| > either I dreamt or that text was removed. I can't tell. Probably the
| > former).
|
| No, I don't think you've dreamt it, because I've heard it, too. :) I think
| it's in D&E, but I haven't found it there, now.
|
| I think the context of the remark was that the rule makes integral types
| special, in that they may be initialised in-class (and not requiring an
| out-of-class definition), whereas you can't do the same with e.g. floating
| point values, or UDTs.

Yes, you're right -- except for the "out-of-class definition" bits.

| However, searching for this on Google, I found this quote
| (http://www.cs.washington.edu/homes/gjb/doc/pcp3-quals/pcp3-paper.ps.gz):
| "Because of the "misfeature" of such declarations [static const] still
| requiring definitions outside of the class, Stroustrup still recommends
| using enums for static integral constant members (i.e., the "enum hack")
| [Str97, p. 249]."

I believe that that sentence may have been in the first printings of
TC++PL3 [at the time, I got the third printing, which someone managed
to steel :-(]

| Maybe the "misfeature" was the fact that they may need definition, anyway?
| And not the fact that they may also _not_ need definition.

Yes, I think the misfeature is that they ought to be of integral type,
static, const and they need definition (at the time, the definition of
"used" required definition) and finally, it doesn't scale to other
types.

-- Gaby


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