Project

General

Profile

Bug #1340

stdint.h doesn't define set of macros for C++ if __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS were not defined

Added by Dmitry Moskalchuk over 3 years ago. Updated about 3 years ago.

Status:
Open
Priority:
High
Category:
libcrystax
Target version:
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.

History

#1 Updated by Dmitry Moskalchuk over 3 years ago

  • Description updated (diff)

#2 Updated by Dmitry Moskalchuk about 3 years ago

Here is corresponding test case.

#3 Updated by Dmitry Moskalchuk about 3 years ago

  • Description updated (diff)

Also available in: Atom PDF