FixedPointsArduino icon indicating copy to clipboard operation
FixedPointsArduino copied to clipboard

Consider replacing some member functions and operators with free functions

Open Pharap opened this issue 4 years ago • 0 comments

Following the current style of not defining functions inside the main body of the class, this would mean that there would be fewer member functions kept inside the class.

This is considered 'breaking' because technically someone could be doing (for example) fixed.operator+=(value) somewhere in their code, which would break when operator+= is no longer a member function.

Anyone using the form fixed += value would be unaffected, and the fact that the vast majority of people are likely to be doing this is precisely why I have little concern about making this change.

However I will schedule this for the next 'breaking' change anyway, as a precaution. This change is more of an internal benefit than an external benefit, so it will most likely go unnoticed for the end user.

Typically there are other benefits associated with using free functions rather than member functions, but the primary driving force behind this change is the improved maintainability.

Pharap avatar Mar 26 '21 15:03 Pharap