static functions?
Andy Valencia
dont at spam.me
Mon Mar 11 15:56:24 UTC 2024
Leveraging my knowledge of C, I assumed a "static" function would
be hidden outside of its own source file. I can't find any
statement about the semantics of a static function in the
documentation, and in practice (ldc2 on Linux) it doesn't hide
the function?
file tst.d:
import std.stdio : writeln;
import tst1;
void
main()
{
writeln(do_op());
writeln(do_op());
}
and file tst1.d:
static int
do_op()
{
static int x;
x += 1;
return(x);
}
More information about the Digitalmars-d-learn
mailing list