any news on const/invariant?

Steven Schveighoffer schveiguy at yahoo.com
Wed Nov 28 19:47:56 PST 2007


"Derek Parnell" wrote
> Also, what is the syntax now for declaring a const function that returns a
> const value?

const const(int)* f(){ ... }
or
const(int)* f() const { ... }

This REALLY REALLY needs an example in the docs.  Walter, please do 
something about this.  The const void f() example doesn't cut it, especially 
for C++ defectors.  I had to ask this question a while back in the learn NG 
after carefully examining the docs :)

Also, will the following compile?

const int* f1() const {...}
invariant int* f2() const {...}

And if they do, what do they mean?

-Steve 





More information about the Digitalmars-d mailing list