Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Formatting: use stdint.h types #35

Open
ElectricRCAircraftGuy opened this issue Apr 13, 2020 · 1 comment
Open

Code Formatting: use stdint.h types #35

ElectricRCAircraftGuy opened this issue Apr 13, 2020 · 1 comment

Comments

@ElectricRCAircraftGuy
Copy link
Collaborator

ElectricRCAircraftGuy commented Apr 13, 2020

This is a sub-issue of #11. Don't close #11 until all sub-issues are resolved.

I will help with this. Just want to teach the principle too is all since you'll write code faster than I can reformat it :).

To make the code cross-platform and clear, each type should have an explicit size. unsigned int on an ATMega328 is 2 bytes, but on an STM32 it is 4 bytes. uint16_t, however, is always 2 bytes on any platform, period. People may want to move your code to a new platform in the future. This will make the process much better.

Here are the standard types: http://www.cplusplus.com/reference/cstdint/

unsigned int --> uint16_t
unsigned long --> uint32_t
int --> int16_t
long --> int32_t

etc.

nit-picks:
also
byte --> uint8_t
boolean --> bool

@ElectricRCAircraftGuy
Copy link
Collaborator Author

PR #46 resolves a tiny portion of this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant