digitalmars.D.learn - What mean "static nested function"?
- Thorn (3/3) Jun 21 2006 Hello, people!
- Kirk McDonald (12/18) Jun 21 2006 "Stack variable" is another way of saying "local variable," e.g.:
Hello, people! I read docs about nested functions and found this sentence: "Static nested functions cannot access any stack variables... blah...". What it mean?
Jun 21 2006
Thorn wrote:Hello, people! I read docs about nested functions and found this sentence: "Static nested functions cannot access any stack variables... blah...". What it mean?"Stack variable" is another way of saying "local variable," e.g.: int foo(int a) { int i; // This is a stack variable. static int bar(int b) { return b + i; // ERROR! bar is static! } return bar(a); } If bar weren't declared static, then that example would work (it would be able to access foo's stack). As it is, it shouldn't compile. -Kirk McDonald
Jun 21 2006