Does dmd have SSE intrinsics?

Daniel Keep daniel.keep.lists at gmail.com
Tue Sep 22 18:33:16 PDT 2009


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;
}



More information about the Digitalmars-d mailing list