user defined literals

Steven Schveighoffer schveiguy at yahoo.com
Fri Mar 25 10:11:19 PDT 2011


On Fri, 25 Mar 2011 12:54:46 -0400, Trass3r <un at known.com> wrote:

> Steven Schveighoffer Wrote:

>> Not only that, but it's compile-time, meaning there is no actual call to
>> some operator processor to generate the timestamp.
>
> You forget CTFE ;)

CTFE is only used when you are defining a compile-time constant, or  
creating a static initializer.

literals are not CTFE'd.  For example, an array literal still calls a  
runtime function to construct the array.

The call could also be optimized out, but when the literal is a generic  
template (not necessarily a function), you can *force* it to be  
compile-time, regardless of optimizations or inlining.

-Steve


More information about the Digitalmars-d mailing list