enum return type

John Colvin john.loughran.colvin at gmail.com
Thu Mar 6 04:09:14 PST 2014


On Wednesday, 5 March 2014 at 23:17:45 UTC, Frustrated wrote:
> how does an enum return type work?
>
> enum foo(string s) { return s; }
>
> is it a purely compile time construct?
>
> That is, we can guarantee that foo, as a function, won't exist 
> at runtime? e.g., it is a true ctfe instead of a function that 
> can be executed at compile time or runtime?

It's not currently possible to force something out of the binary, 
but to guarantee that something isn't called at runtime you can 
always just add an assert(__ctfe); at the start of the function 
or in the "in" contract.


More information about the Digitalmars-d-learn mailing list