Does dmd have SSE intrinsics?
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Sep 22 19:48:52 PDT 2009
Daniel Keep wrote:
> Andrei Alexandrescu wrote:
>> Daniel Keep wrote:
>>> P.S. And another thing while I'm at it: why can't we declare void
>>> variables? This is another thing that really complicates generic code.
>> How would you use them?
>>
>>
>> Andrei
>
> Here's an OLD example:
>
> ReturnType!(Fn) glCheck(alias Fn)(ParameterTypeTuple!(Fn) args)
> {
> alias ReturnType!(Fn) returnT;
>
> static if( is( returnT == void ) )
> Fn(args);
> else
> auto result = Fn(args);
>
> glCheckError();
>
> static if( !is( returnT == void ) )
> return result;
> }
>
> This function is used to wrap OpenGL calls so that error checking is
> performed automatically. Here's what it would look like if we could use
> void variables:
>
> ReturnType!(Fn) glCheck(alias Fn)(ParameterTypeTuple!(Fn) args)
> {
> auto result = Fn(args);
>
> glCheckError();
>
> return result;
> }
ReturnType!(Fn) glCheck(alias Fn)(ParameterTypeTuple!(Fn) args)
{
scope(exit) glCheckError();
return Fn(args);
}
:o)
Andrei
More information about the Digitalmars-d
mailing list