CompileTime performance measurement

Marco Leise via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 9 01:42:37 PDT 2016


Am Tue, 06 Sep 2016 05:02:54 +0000
schrieb timepp <tongjunhui at live.cn>:

> On Sunday, 4 September 2016 at 04:24:34 UTC, rikki cattermole 
> wrote:
> > void writeln(T...)(T args) {
> > 	if (__ctfe){
> > 		debug {
> > 			__ctfeWriteln(args);
> > 		}
> > 	} else {
> > 		// ... current implementation
> > 	}
> > }
> >
> > Are you sureeeee?  
> any usage example?
> 
> consider a normal usage:
> writeln("done.");
> 
> I just want a runtime output. how can I tell the compiler not to 
> print "done." at compile time?

If you actually call a function during compile-time that uses
writeln and want it to be silent you would write:

  if (!__ctfe) writeln("done.");

-- 
Marco



More information about the Digitalmars-d mailing list