Mercurial > projects > dstress
changeset 1414:aaf99ec76365
Re: Compile time function execution...
torhu <fake@address.dude>
2007-02-15
http://www.digitalmars.com/webnews/newsgroups.php?search_txt=&group=digitalmars.D&article_id=48845
author | thomask |
---|---|
date | Sun, 11 Mar 2007 11:06:16 +0000 |
parents | 16360a39d709 |
children | 088bb4a67d95 |
files | compile/c/const_44_A.d compile/c/const_44_B.d compile/c/const_44_C.d |
diffstat | 3 files changed, 51 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compile/c/const_44_A.d Sun Mar 11 11:06:16 2007 +0000 @@ -0,0 +1,17 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ torhu <fake@address.dude> +// @date@ 2007-02-15 +// @uri@ http://www.digitalmars.com/webnews/newsgroups.php?search_txt=&group=digitalmars.D&article_id=48845 +// @desc@ Re: Compile time function execution... + +module dstress.compile.c.const_44_A; + +int square(int x){ + return x * x; +} + +const int foo = square(5); +static assert(25 == foo);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compile/c/const_44_B.d Sun Mar 11 11:06:16 2007 +0000 @@ -0,0 +1,17 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ torhu <fake@address.dude> +// @date@ 2007-02-15 +// @uri@ http://www.digitalmars.com/webnews/newsgroups.php?search_txt=&group=digitalmars.D&article_id=48845 +// @desc@ Re: Compile time function execution... + +module dstress.compile.c.const_44_B; + +double square(double x){ + return x * x; +} + +const double foo = square(5); +static assert(25 == foo);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compile/c/const_44_C.d Sun Mar 11 11:06:16 2007 +0000 @@ -0,0 +1,17 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ torhu <fake@address.dude> +// @date@ 2007-02-15 +// @uri@ http://www.digitalmars.com/webnews/newsgroups.php?search_txt=&group=digitalmars.D&article_id=48845 +// @desc@ Re: Compile time function execution... + +module dstress.compile.c.const_44_C; + +double square(idouble x){ + return x * x; +} + +const double foo = square(5.0i); +static assert(25 == foo);