xiaoxiang781216 edited a comment on issue #131: Improve config
URL: https://github.com/apache/incubator-nuttx/pull/131#issuecomment-579714930
 
 
   The key point is the mismatch size_t definition between toolchain(NOT 
newlib/glibc) and NuttX, the fix could be:
   1. Provide the different new/delete prototype base on CONFIG_CXX_NEWLONG, 
the drawback is that:
   - We have to change defconfig again and again since the different toolchain 
may provide the different size_t definition.
   - new/delete is provided by libcxx/uClibc++ if we enable them, or even user 
code can provide their own implementation to overwrite the default one per C++ 
standard. It's ugly to demand 3rd party  to hack their standard compliance code.
   - Note: to fix the 2nd issue, it's better to change CONFIG_CXX_NEWLONG to 
CONFIG_SIZE_T_LONG and change size_t typedef directly, so all location which 
use size_t as argument could get fixed automatically.
   2. Ensure NuttX use the same size_t definition as toolchain, which could be 
achieved by:
   - Use the compiler provide the header file directly, it isn't a big issue at 
least for gcc/clang because stddef.h is self contain as I mention in the 
prevous comment. Actually, I suggest we should use all header files provided by 
compiler(e.g. float.h, stdarg.h, stdbool.h, stddef.h...) to aovid any potential 
conflict.
   - Define size_t to __SIZE_TYPE__(at least gcc/clang define it) if 
__SIZE_TYPE__ is defined:
        https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to