-
Couldn't load subscription status.
- Fork 20
Description
There is potential for an optional Observations section in guidelines. It would allow the authors to add relevant information that doesn't directly affect the Safety aspects of code, yet merits to be pointed out.
The example that motivated this issue is @vapdrs's PR for a Subset Rule to avoid division by zero: #136. In the Rationale section, he points out how using NonZero<T> allows the compiler to safely optimize the code, further than any other compliant way to perform integer division. This is a performance consequence that isn't obvious at first glance.
This issue exists to help us keep a list of such considerations: anything that stems from complying to a Guideline, that:
- Might not be obvious at first glance, and
- Affects a scope beyond Safety.
The current list:
- [Guideline] Add safe division guideline to avoid dividing by zero #136: using
NonZero<T>allows the compiler to elide further zero-checks after the creation of the divisor, thus performing division and remainder by that value as fast as the hardware can muster.