Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c++
Subject: Re: Is this really necessary
Date: Tue, 10 Aug 2021 06:11:33 -0700
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <8635rh1m2i.fsf@linuxsc.com>
References: <86im0h2fi1.fsf@linuxsc.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="8983d14e45a299e43fc74f5563f3d6b2"; logging-data="15354"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19g8iIm/FWIXO8n5J+jiU+eUuaTytJ9M7o="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:+2yc7H2UocZ5V2VqlwvznEf1240= sha1:ubTFQXorObHtADaAAGFEiQnaXGE=
Xref: csiph.com comp.lang.c++:80823
Vir Campestris writes:
[..stuff about 64 bit systems removed..]
> What bothers me about ptr_diff_t is the size. The difference between
> two 32-bit pointers is plus or minus 4GB. Which needs a 33 bit value
> :(
>
> As it happens it's never been a practical problem as I've never had a
> 32 bit system with more than 2GB RAM,
It isn't necessary for there to be more than 2GB of RAM for
problems with ptrdiff_t to manifest (in 32-bit linux). A call to
malloc() will gladly return a memory area larger than all of RAM
if there is swap space to hold it.