Mercurial > projects > dstress
changeset 1416:abcf8e538bac
Re: Compile time function execution...
Bill Baxter <dnewsgroup@billbaxter.com>
2007-02-16
http://www.digitalmars.com/webnews/newsgroups.php?group=digitalmars.D&article_id=48869
author | thomask |
---|---|
date | Sun, 11 Mar 2007 11:08:24 +0000 |
parents | 088bb4a67d95 |
children | b9844b283021 |
files | run/c/const_45_A.d |
diffstat | 1 files changed, 27 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/c/const_45_A.d Sun Mar 11 11:08:24 2007 +0000 @@ -0,0 +1,27 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Bill Baxter <dnewsgroup@billbaxter.com> +// @date@ 2007-02-16 +// @uri@ http://www.digitalmars.com/webnews/newsgroups.php?group=digitalmars.D&article_id=48869 +// @desc@ Re: Compile time function execution... + +module dstress.run.c.const_45_A; + +char[] UpToSpace(char[] x){ + int i=0; + while (i<x.length && x[i] != ' ') { + i++; + } + return x[0..i]; +} + +int main(){ + const y = UpToSpace("first space was after first"); + if("first" != y){ + assert(0); + } + return 0; +} +