Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Jul 2008 19:51:11 +0200
From:      Erik Trulsson <ertr1013@student.uu.se>
To:        Pietro Cerutti <gahr@FreeBSD.org>
Cc:        Kostik Belousov <kostikbel@gmail.com>, ports@freebsd.org, bug-followup <bug-followup@freebsd.org>, fjoe@freebsd.org
Subject:   Re: ports/124985: [patch] devel/dmucs unbreak on 64bits archs
Message-ID:  <20080707175111.GA71534@owl.midgard.homeip.net>
In-Reply-To: <48725051.3090601@FreeBSD.org>
References:  <200807071619.m67GJrPt096421@freefall.freebsd.org> <487245AE.1030307@FreeBSD.org> <20080707164119.GG17123@deviant.kiev.zoral.com.ua> <48725051.3090601@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jul 07, 2008 at 07:20:17PM +0200, Pietro Cerutti wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
> 
> Kostik Belousov wrote:
> | On Mon, Jul 07, 2008 at 06:34:54PM +0200, Pietro Cerutti wrote:
> |> I definitely do not agree. Please note that a pointer is not required to
> |> fit into a long, while it is required to fit into a size_t.
> | I do not think that C99 requires the size_t to be capable of holding
> | the pointer. size_t is only required to hold result of sizeof.
> 
> size_t is required to be of rank equal to or greater than any other
> object you can create from within the C language. This implies that it
> can (i.e., it is required to be able to) hold a pointer type.

Wrong.  There is no requirement in C that there exists *any* integer
type large enough to hold a pointer - and certainly not that size_t
is such a type.

size_t must be large enough to hold the size of any object that the C
implementation allows you to create, but there is no requirement that
you can create an object that occupies the whole memory space.

(E.g. if you had an implementation that did not allow to create
any arrays larger than 4GB or to malloc() more than 4GB at a time, 
then it would suffice to have a 32-bit size_t even if pointers
were 64-bit.  (For older machines make that: 64KB objects, 16-bit size_t
and 32-bit pointers.))


> 
> |
> | It is intptr_t type that shall do it.
> 
> Unfortunately intptr_t is not defined prior to C99, and I still haven't
> got used to use it. Yes, that would be the preferred solution.
> 




-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013@student.uu.se



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080707175111.GA71534>