Predefined Version expansion

Daniel Keep daniel.keep.lists at gmail.com
Tue Apr 3 20:30:49 PDT 2007



Walter Bright wrote:
> Don Clugston wrote:
>> Yes, it's possible to detect the CPU type at runtime, but the
>> performance penalty is appalling for very short functions.
> 
> If it is, then one should put the switch at an enclosing level.

Out of interest, which is faster: a branch at the start of a function
(say, just a comparison with a bool), or using function pointers that
are set up to point to the correct implementation at start-up?

	-- Daniel

-- 
int getRandomNumber()
{
    return 4; // chosen by fair dice roll.
              // guaranteed to be random.
}

http://xkcd.com/

v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP  http://hackerkey.com/



More information about the Digitalmars-d mailing list