immutable, const, enum

bearophile bearophileHUGS at lycos.com
Tue Apr 28 17:09:56 PDT 2009


Paul D. Anderson:
> From the D2.0/Language/Functions page, under Function Parameters:
> "The in storage class is equivalent to const scope."
> That's why the "const in" combination doesn't work.

Why is this working then, and printing 100?

import std.stdio: writeln;
void foo(const ref int x) {
    writeln(x * 10);
}
void main() {
    int y = 10;
    foo(y);
}

Note that the following doesn't compile:
void foo(in ref int x) {

Bye,
bearophile



More information about the Digitalmars-d mailing list