std C/C++ patch
Eddie Kohler
kohler at icir.org
Wed Apr 24 10:52:52 EDT 2002
Hi Scott,
Thanks very much for the patch! It's integrated.
I was going to write how this
> redundant default argument in method definition,
was actually legal C++ -- page 153 of my Stroustrup v3: "A default argument
can be repeated in a subsequent declaration in the same scope but not
changed." -- but then the standard text disagrees. Crap. I like repeating
default arguments.
I was disturbed to read this in the standard:
9.4.2 P4) If a static data member is of const integral or const
enumeration type, its declaration in the class definition can specify a
constant-initializer which shall be an integral constant expression
(5.19). In that case, the member can appear in integral constant
expressions within its scope. The member shall still be defined in a
namespace scope if it is used in the program and the namespace scope
definition shall not contain an initializer.
which basically says that you can say in the class header 'class C { static
const int FOO = 5; };', but then you have to say in some .cc file somewhere
'const int C::FOO;'. Barf. Stroustrup says to use enums because of this
misfeature, so I switched a bunch of our 'static const int's into enums.
Eddie
More information about the click
mailing list