What about have configure look for uintptr_t if it does not exist then have configure check if unsigned long long is large enough, if not try size_t otherwise barf? Barry On Nov 16, 2009, at 1:55 PM, Jed Brown wrote:
Barry Smith wrote:
Jed,
Seems ok to me. Feel free to update PETSc. (But I think PETSc style would detect that your PETSC_ALIGN() macro would be called PetscMemAlign() or something, we only use caps for macros that are fixed values, not for macros that like functions.)
Indeed (though there are a few exceptions).
Although stdint.h (which contains uintptr_t) is required by C99, I suppose it's likely that it's broken somewhere. On Win64, unsigned long is not sufficient so we need unsigned long long (also required by C99, but not in C++). This is messy enough that we may as well work around it by truncating the pointer into an unsigned, computing the shift, and adding the shift through a (char*) cast. Please speak up if uintptr_t is actually reliable. (I just require a C99 compiler and don't tolerate non-compliance, but PETSc can't do that).
Jed
participants (1)
-
Barry Smith