Hi Kees, *,

Am 2. Juli 2016 13:21:19 MESZ, schrieb Kees Bakker <k...@sodaq.com>:
>While going through the code I notice that there are too many "magic"
>constants. Hard coded numbers that are obvious for some, but not
>obvious
>for others. My advise: always try to use defines and add a comment
>about
>what constants mean. Or point to datasheet sections explaining the 
>constants.

Thank you for bringing this up.

I am uncertain if there is something that can be done about it in the existing 
code base, but at least we should find a way to prevent such issues in the 
future:

- Is there something in the (if, then probably Linux) coding conventions 
already?
- if not, is anyone opposing the addition of such a rule?
- if we have/want such a rule, can/should we add a static rule check for this 
in addition to the rule itself?

I support adding such a rule of it does not exist yet.
In my experience the false positives are heavily outweighed by true magic 
numbers of the kind we want to avoid.
Therefore, for both the rule and the static rule check I would strongly 
recommend it.

Cheers,
Ludwig
_______________________________________________
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel

Reply via email to