> As I said before, I don't understand you. For
> ordinary functions and
> variables, 'static' has to have the same effect in C++
> as in C.
I'm talking about methods. I tried this on some compilers long time ago,
and it failed.
class x {
private:
void xx(void);
};
static void x::xx(void)
{
}
BC++ 3.1 complained that multiple storage classes specified. OK, first one
is static. But what is second? 'Method that has to be visible to other
modules even if it is private and is used only in this module, with the
compiler being responsible for preventing others to access it'? Impressive.
> Stroustrup discussed this in "The Design and
> Evolution of C++" (p.
> 266/7). As a rule of thumb, he has always been very
> reluctant adding
> new features to C++ if their effect could be
> reached using the
> existing features (a virtual accessor method in this
> case).
Correct, but it's two-in-one, virtual accessor to the static variable. And
he is contradicting with himself, 'long float' = 'double', 'for' = 'do
something, while(), { ... do something }', wtf is 'signed' or 'auto'? Anyone
there who is seriously using it? And where are 'bit' enums that have values
0x0001, 0x0002, 0x0004, and so on instead of 0, 1, 2, 3...? I don't think i'm
the only one who would like to see them.
> Yes, RTTI provides this functionality. Using
> RTTI can be very
> convenient sometimes, but it's good to always think
> twice before using
> it because it tempts you to design badly.
Dunno, never used one (hopefully never will).
> PS: I agree with the general message of your
> message: overloading
> keywords (static, virtual) doesn't seem to be very
> fortunate.
Not the overloading itself, but the context-dependant usage that is
different for ordinary functions and functions that have implied first
parameter as a pointer to something (and even the function itself is called
method, accessor or maybe something else).
---
---------------
* Origin: A point in the middle of nowhere (2:490/31.3100)
|