Bug #7626 Compilation failure: Type 'uintptr_t' not portable.
Submitted: 3 Jan 2005 12:48 Modified: 3 Jan 2005 20:48
Reporter: Joerg Bruehe Email Updates:
Status: Closed Impact on me:
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S1 (Critical)
Version:5.0.3-pre OS:various Unix
Assigned to: Jonas Oreland CPU Architecture:Any

[3 Jan 2005 12:48] Joerg Bruehe
Type 'uintptr_t' is not as portable as should be assumed (it is required by POSIX as some unsigned integral type which can hold pointer values).

In the current 5.0.3 build (pulled on Dec 31), we have several problems with it:

1) On some platforms, it is not defined by the system:
cc: Error: ../../../../ndb/include/ndb_types.h, line 46: In this declaration, "uintptr_t" appears to be used as if it named a type, but there is no declared type of that name visible. (typedefnotdef)
typedef uintptr_t UintPtr;

2) On other platforms (including HP and Sun), it gives double definition:
"/usr/include/sys/_inttypes.h", line 89: error 1584: Inconsistent type declaration: "uintptr_t".
"/usr/include/sys/int_types.h", line 108: identifier redeclared: uintptr_t

How to repeat:
Try to compile including NDB on all platforms.

Suggested fix:
Brute force approach:
Use the CPP symbols defining pointer and integer type sizes, and select that unsigned type whose size matches  the pointer size.
[3 Jan 2005 12:49] Joerg Bruehe
(Fixed typo in synopsis)
[3 Jan 2005 18:20] Jonas Oreland
fixed as suggested