Delight
Sergey Gromov
snake.scaly at gmail.com
Sun Sep 28 15:45:31 PDT 2008
Sun, 28 Sep 2008 18:04:08 -0400,
bearophile wrote:
> static if (mainmodule) {
> void main() {
> static if (do_benchmarks) {
> putr("\nSome benchmarks:");
> benchmark1();
> benchmark2();
> }
> }
> }
>
> Do you like?
There is no main module in D. The main() function can be in any module.
There are no specific privileges for the first module on the command
line except sometimes compiler derives an output name from it.
Why don't you want to use versions instead? For the module builders for
instance it could be:
version (builders) {
version (benchmark) {
import d.time: clock;
benchmark1() {...}
benchmark2() {...}
}
}
version (builders) {
void main() {
version (benchmark) {
putr("\nSome benchmarks:");
benchmark1();
benchmark2();
}
}
}
do unittests:
bud builders -unittest -version=builders
benchmark:
bud builders -version=builders -version=benchmark
More information about the Digitalmars-d-announce
mailing list