(no title)
jjmarr | 3 days ago
* Function names must start with a verb.
* Use standard algorithms instead of for loops.
* Refactor your code to use IIFEs to make variables constexpr.
The verb one is the best example. Since we work adjacent to hardware, people like creating functions on structs representing register state called "REGISTER_XYZ_FIELD_BIT_1()" and you can't tell if this gets the value of the first field bit or sets something called field bit to 1.
If you rename it to `getRegisterXyzFieldBit1()` or `setRegisterXyzFieldBitTo1()` at least it becomes clear what they're doing.
No comments yet.