What is 'scope' in function parameter?
Sobaya
sobaya007 at gmail.com
Mon Dec 25 10:42:55 UTC 2017
What means 'scope' in function parameter?
I made a test code.
```
import std.stdio;
int[] x;
void func(scope int[] a) {
x = a;
}
void main() {
func([0,1,2]);
writeln(x);
}
```
This code was successfully compiled and printed '[0, 1, 2]'.
But according to https://dlang.org/spec/function.html, above code
must cause a compile error.
Could you give me any advice?
More information about the Digitalmars-d-learn
mailing list