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

Use uintptr_t type for ThreadID #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hlovdal
Copy link

@hlovdal hlovdal commented Feb 17, 2019

For Arduino target code there is no difference between int and pointer sizes but it matters when compiling the code for unit test on a 64bit linux host computer:

.../arduino/sketchbook/libraries/ArduinoThread/Thread.cpp: In constructor ‘Thread::Thread(void (*)(), long unsigned int)’:
.../arduino/sketchbook/libraries/ArduinoThread/Thread.cpp:9:18: error: cast from ‘Thread*’ to ‘int’ loses precision [-fpermissive]
  ThreadID = (int)this;
                  ^~~~

For Arduino target code there is no difference between int and pointer sizes, e.g.
$HOME/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino4/avr/include/stdint.h
   typedef uint16_t uintptr_t;

but it matters when compiling the code for unit test on a 64bit linux host computer:

.../arduino/sketchbook/libraries/ArduinoThread/Thread.cpp: In constructor ‘Thread::Thread(void (*)(), long unsigned int)’:
.../arduino/sketchbook/libraries/ArduinoThread/Thread.cpp:9:18: error: cast from ‘Thread*’ to ‘int’ loses precision [-fpermissive]
  ThreadID = (int)this;
                  ^~~~
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.

None yet

1 participant