This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
std::size_t and pointer size in C++ (was Re: [Patch]: ggc-page.c: use uintptr_t instead of size_t)
- From: VÃclav Zeman <vhaisman at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 20 Mar 2012 16:25:00 +0100
- Subject: std::size_t and pointer size in C++ (was Re: [Patch]: ggc-page.c: use uintptr_t instead of size_t)
I have noticed the following email in gcc-patches:
On 20 March 2012 10:41, Tristan Gingold wrote:
> Hi,
>
> ggc-page.c uses size_t to cast pointers to an integer type. ÂUnfortunately, this isn't portable for systems (such as â VMS) where size_t precision is less than pointers precision.
>
> Fortunately, thanks to configure, uintptr_t type is always present, so this path simply replaces size_t by uintptr_t for such conversions (but still keeping size_t for size expressions).
>[...]
This is interesting for me from C++ library author point of view. I
have always silently (without support in the ISO standard) assumed
that std::size_t is the same or bigger width than data pointers. This
is true for all platforms I have ever worked with. But I have never
worked with VMS. So, the question is: Is there a native C++ type that
is the same bit width as pointers on VMS? Maybe std::ptrdiff_t?
--
VZ