Search

stdint.h UINTPTR_MAX has the same value as UINT32_MAX for 64-bit platforms by Olaf Trygve Berglihn

Closed
as Fixed Help for as Fixed

1
0
Sign in
to vote
Type: Bug
ID: 721786
Opened: 1/31/2012 5:42:19 AM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
0
User(s) can reproduce this bug
On 64-bit platform with 64-bit Visual Studio, I expected UINTPTR_MAX from stdint.h to give more than UINT32_MAX.
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling version

Visual Studio 2010 SP1

Steps to reproduce

#include <stdio.h>
#include <stdint.h>

int main(int argc, char *argv[])
{
    printf("UINTPTR_MAX: %lu\n", UINTPTR_MAX);

    /* We assume it is an error if the address space of a 64-bit code is less
     * or equal to that of a 32-bit code. */
    if((sizeof(void *) == 8) && (UINTPTR_MAX <= UINT32_MAX))
                    fprintf(stderr, "UINTPTR_MAX <= UINT32_MAX\nBug??\n");
    return 0;
}

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

UINTPTR_MAX: 4294967295
UINTPTR_MAX <= UINT32_MAX
Bug??

Expected results

UINTPTR_MAX: 18446744073709551615
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 2/1/2012 at 1:42 PM
Hi,

Thanks for reporting this bug. We've already fixed it (back in June 2011) and the fix will be available in VC11.

stdint.h now says:

#ifdef _WIN64
#define INTPTR_MIN     INT64_MIN
#define INTPTR_MAX     INT64_MAX
#define UINTPTR_MAX     UINT64_MAX
#else /* _WIN64 */
#define INTPTR_MIN     INT32_MIN
#define INTPTR_MAX     INT32_MAX
#define UINTPTR_MAX     UINT32_MAX
#endif /* _WIN64 */

If you have any further questions, feel free to E-mail me at stl@microsoft.com .

Stephan T. Lavavej
Visual C++ Libraries Developer
Posted by MS-Moderator09 [Feedback Moderator] on 1/31/2012 at 9:39 PM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. Your issue has been routed to the appropriate VS development team for review. We will contact you if we require any additional information.
Posted by MS-Moderator01 on 1/31/2012 at 6:43 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.