Can you do this in D?

Nick Sabalausky SeeWebsiteToContactMe at
Thu Jul 26 22:24:45 PDT 2012

On Thu, 26 Jul 2012 19:35:56 +0200
"David Piepgrass" <qwertie256 at> wrote:
> For example if I do
> enum twoPi = computePi() + computePi();
> I don't know if the compiler computes PI once or twice. Does 
> someone know? But if I define this template:

You could toss a ctfeWriteln (or whatever it's named) into
'computePi' and find out.

It shouldn't NEED to evaluate it twice since CTFE isn't allowed to
have any global mutable state.

More information about the Digitalmars-d mailing list