Standard way to supply hints to branches

Walter Bright newshound2 at digitalmars.com
Sun Sep 1 00:34:03 UTC 2024


On 8/31/2024 9:11 AM, Dom DiSc wrote:
> I already asked this question.
> He said a single break or goto is NOT considered the hot branch by the compiler.
> But I don't like this, because it's an implementation detail that every compiler 
> may implement or not, and it's not documented anywhere.
> Maybe if the documentation would clearly state at a prominent point that a 
> single break or goto has to be considered the cold path by the compiler, but a 
> function call is to be considered the hot path (and all related queries about 
> branch priorization link there), then I would consider this a solution. But is 
> it likely this will happen?

It's the obvious consequence of laying out the code in the same order as the 
programmer laid it out. AFAIK every compiler does this by default.


More information about the Digitalmars-d mailing list