Bug #1340
stdint.h doesn't define set of macros for C++ if __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS were not defined
Start date:
03/23/2016
Due date:
% Done:
0%
Estimated time:
CPU Architecture:
Host OS:
Toolchain:
Android version:
CrystaX Version:
Description
Simple C++ program fails, being unable to find PTRDIFF_MAX (if compiling this code as C, it works fine):
#include <stdint.h> // for PTRDIFF_MAX
#include <stddef.h> // for ptrdiff_t
int main()
{
ptrdiff_t x = PTRDIFF_MAX;
return 0;
}
The same code compiles just fine with host gcc and clang on both OS X and GNU/Linux systems.
This is consequence of the old problem with dealing with C and C++ headers in C++ code. Here is good explanation of its roots and how its fixed nowadays in the new C++ standard.