4 ms·
This. In the article, Carmack does suggest just this, although its not as explicitly called out. If your methods are functional, then int fancyNumber = ca
by MyNameIsFred 10y ago
This. In the article, Carmack does suggest just this, although its not as explicitly called out.
If your methods are functional, then
int fancyNumber = calculateFancyNumber();
Can be inclined cleanly/equivalently as:
int fancyNumber;
{
// [Mathy stuff redacted]
fancyNumber = someIntermediateVariable / anotherIntermediateVariable;
}
- Fillipoman 10y agoAnd with c++11 you can use a lambda capture to make it even cleaner (I'm not sure if this is the right syntax) [&fancyNumber] { // [Mathy stuff redacted] fancyNumber = someIntermediateVariable / anotherIntermediateVariable; }();