Tidy attributes

bearophile bearophileHUGS at lycos.com
Thu Mar 11 13:20:35 PST 2010


While looking for possible attribute problems to add to Bugzilla, I have seen the following D2 program compiles and runs with no errors or warnings:


static foo1() {}
final foo2() {}
ref foo3() {}
enum void foo5() {}
nothrow foo4() {}
pure foo6() {}
static int x1 = 10;
static x2 = 10;
void main() {}


I don't like that code, but I don't know if it's correct.

- What is a static global function in D?
- A final global function?
- Is that ref of void correct? (I think it is not)
- A enum of void function?
- What are global static variables in D?
- Are most of those attributes supposed to not need the "void"?


The following lines don't compile, is this supposed to be correct? 

int static x3 = 10;
int enum x4 = 1;
int const x5 = 2;

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list