Programming

Mundane number golf

There was an online discussion regarding ‘magic numbers’ in software – numeric constants serving an important role with no description or justification for their value – and one static analysis tool’s assertion that the only numeric constants permissible in statements are -1, 0, and 1. Although the significance of undocumented numbers in written software is often not readily apparent, sometimes the function of a number really is nothing beyond its literal value, and this sort of overzealous rule is guaranteed to complain about expressions whose intent actually is readily apparent – but none of that actually matters because someone soon ported the …

More…