Implementing Half Floats in D

TommiT tommitissari at hotmail.com
Tue Jan 29 02:40:58 PST 2013


On Tuesday, 29 January 2013 at 08:48:24 UTC, Simen Kjaeraas wrote:
> Except that's not a literal. 1.3.hf would be a function call, 
> while hf!1.3f
> is a template instantiation.

Can't help but point out, that some time ago, I made a suggestion 
to add a new function attribute to the language that would mean 
"evaluate any call to this function at compile time whenever it's 
possible". That would enable literals like:

1.3.hf
and
ComplexToConstruct(2.5, 7.5)

Given:
@property HalfFloat hf(float v) @aggressive_ctfe;
and...
struct ComplexToConstruct
{
     this(float x, float y) @aggressive_ctfe;
}


More information about the Digitalmars-d mailing list