Standard way to supply hints to branches
Walter Bright
newshound2 at digitalmars.com
Sat Aug 24 02:34:04 UTC 2024
I recently learned a syntactical trick on how to do this.
```
if (x) return;
if (y) return;
if (z) return;
hotPath();
```
Rewrite as:
```
do
{
if (x) break;
if (y) break;
if (z) break;
hotPath();
} while (0);
```
Of course, this will also work:
```
if (x) goto Lreturn;
if (y) goto Lreturn;
if (z) goto Lreturn;
hotPath();
Lreturn:
```
More information about the Digitalmars-d
mailing list