- To: gcc-help@xxxxxxxxxxx
- Subject: 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@xxxxxxxxx>
- Date: Tue, 20 Mar 2012 16:25:00 +0100
- Comment: DKIM? See http://www.dkim.org
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
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
[Linux C Programming]
[Linux Kernel]
[eCos]
[Fedora Development]
[Fedora Announce]
[Autoconf]
[The DWARVES Debugging Tools]
[Yosemite Campsites]
[Yosemite News]
[Linux GCC]