"static" means too many things

H. S. Teoh hsteoh at quickfur.ath.cx
Tue May 1 17:35:38 PDT 2012


On Wed, May 02, 2012 at 01:46:37AM +0200, bearophile wrote:
> This is the brief of some D code, it shows one consequence of the
> excessive overloading of the D "static" keyword:
> 
> struct Foo {
>     bool solve() {
>       /*static*/ bool fill(int r, int c, Cell n) {
>           // ...
>           if (fill(r + i, c + j, n + 1))
>             return true;
>       }
> 
>       return fill(x, y, 1);
>     }
> }

Wait, I thought static in the context of fill() can only mean "function
without frame pointer"? Because static members of Foo cannot be declared
inside solve(), they'd have to be directly under Foo.

Or am I misunderstanding something here?

That said, though, I do find that D overloads the keyword 'static'
excessively.


T

-- 
MASM = Mana Ada Sistem, Man!


More information about the Digitalmars-d-learn mailing list