Skip to content

Explicitly cast numeric literals to type byte to avoid ESP32 and ESP8266 compile errors #8

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

Merged
merged 5 commits into from
Apr 20, 2020

Conversation

fourstix
Copy link

*** This is the correct pull request to merge. It only changes one file with the fixed lines.***
*** An incorrect comment line is also moved. ***

This is a fix for issue #6. The ESP32 and ESP8266 code uses templates to define the min/max function. This causes a compile error because the numerical literals are of implicit type (int) being compared to a byte parameter.

Even though the types are compatible, this type mismatch causes a compile error in the template used to define the min/max function in the ESP32 and ESP8266 code.

This fix explicitly casts the numeric literals in min() and max() to type (byte) and eliminate the compile error. The incorrect comment is removed.

@fourstix
Copy link
Author

This pull request contains the fix, and removes the comment with the incorrect return type.

@nseidle
Copy link
Member

nseidle commented Apr 20, 2020

Thanks for this! Makes sense.

@nseidle nseidle merged commit d8f4b77 into sparkfun:master Apr 20, 2020
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

Successfully merging this pull request may close these issues.

3 participants