[Uml-devel] [Bug 60452] missing keywords for declaring operations and variables
mtdean at hotmail.com
Sun Jul 6 07:03:06 UTC 2003
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
------- Additional Comments From mtdean at hotmail.com 2003-07-06 16:01 -------
Oh, I also forgot the keyword mutable.
(In case anyone is not familiar with the keyword mutable, it's a flag to tell
the compiler the constness of a variable can be cast away)
mutable int myint;
int main( int argc, char** argv )
const A myA;
myA.myint = 5; // **** ERROR **** myint is const because it's containing
// class is const
const_cast<A>(myA).myint = 5; // This compiles fine because its constness
// has been cast away by const_cast<T>()
const_cast<A>(myA).notmyint = 5; // **** ERROR **** will not compile because
// notmyint was not declared mutable
I think I've thought of all the neccessary missing keywords now (hopefully).
BTW, http://www.gotw.ca/gotw/006.htm is a great guru article on when to use
const and when to not, if anyone's interested in it. It's by Herb Sutter, good
More information about the umbrello-devel