SmingHub / Sming

Sming - powerful open source framework simplifying the creation of embedded C++ applications.
https://sming.readthedocs.io
GNU Lesser General Public License v3.0
1.45k stars 349 forks source link

Use `intptr_t` etc. when casting pointers #2811

Closed mikee47 closed 2 weeks ago

mikee47 commented 2 weeks ago

Assuming that, for example, void* can be cast to uint32_t and vice-versa is not portable since platforms can have different sizes. Correct types to use are intptr_t and uintptr_t which are 32-bit for all the architectures we care about, and 64-bit for modern OS builds without 32-bit compatibility mode. It also makes it clearer that values are likely cast from pointers.