"likely" keyword for D?

%u wfunction at hotmail.com
Tue Mar 22 21:59:33 PDT 2011


I just thought of a (crazy) idea:

Should D implement a "likely" keyword for if statements?
Something like:

if likely (x == 2)
{
    //do something
}

This would allow the compiler to generate branch prediction code for
the program, allowing the programmer to prevent branch predictions.

It's a crazy (and new?) idea... any thoughts?


More information about the Digitalmars-d mailing list