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

Replaced 'int' type with 'intptr_t' type in pointer arithmetic for compiling without -fpermisive + revisions by McNeight #8

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

s-t-a-n
Copy link

@s-t-a-n s-t-a-n commented Jan 17, 2021

Compiler yabs about losing precision:

~/Arduino/libraries/MemoryFree/src/MemoryFree.cpp:44:7: error: cast from 'void*' to 'int' loses precision [-fpermissive]

Using intptr_t type (as per C99 I believe) is recommended because it guarantees to hold the size of a pointer.

The Arduino IDE compiles with -fpermisive by default, but continuous integration frameworks like Arduino-CI and Cmake/Makefile type compilation does not.

Tested in Arduino-CI and on an Arduino Mega2560.

EDIT: I accidentally opened a pull request for this repo whilst I meant to open it for McNeights. Close it if you like. Pull it if you want.

McNeight and others added 5 commits March 20, 2015 15:28
@s-t-a-n s-t-a-n closed this Jan 17, 2021
@s-t-a-n
Copy link
Author

s-t-a-n commented Jan 17, 2021

oops wrong repo sorry :(

EDIT: I'll leave it here since it seems to contain usefull edits.

@s-t-a-n s-t-a-n changed the title Replaced 'int' type with 'intptr_t' type in pointer arithmetic for compiling without -fpermisive Replaced 'int' type with 'intptr_t' type in pointer arithmetic for compiling without -fpermisive + revisions by McNeight Jan 17, 2021
@s-t-a-n s-t-a-n reopened this Jan 17, 2021
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