cleaner & greener (was Re: A patch for RTEMS4.10.0 PowerPC heap space initialization)
Sebastian Huber
sebastian.huber at embedded-brains.de
Thu May 12 11:23:07 UTC 2011
On 05/12/2011 01:10 PM, Peter Dufault wrote:
>
> On May 12, 2011, at 6:10 , Sebastian Huber wrote:
>
>> No, uintptr_t is the type used by the heap code. We work here with addresses
>> and not sizes of single objects.
>
> I had to look up the definition of uintptr_t. At least according to Wikipedia it's C99 and is defined as:
>
> ====
> Integers wide enough to hold pointers
> intptr_t and uintptr_t is a signed and unsigned integer which are guaranteed to hold the value of a pointer. These two types are optional.
To fulfill this we need sizeof(void *) <= sizeof(uintptr_t).
>
> "The limits of these types are defined with the following macros:
>
> • INTPTR_MIN is the minimum value (−32,767 [−215 + 1] or less) of intptr_t.
> • INTPTR_MAX is the maximum value (32,767 [215 − 1] or greater) of intptr_t.
> • UINTPTR_MAX is the maximum value (65,535 [216 − 1] or greater) of uintptr_t.
> ====
These are the portable limits and thus restricted to 16 bits.
[...]
> void
> bsp_get_work_area(
> address_type *work_area_begin,
> address_size_type *work_area_size,
> address_type *heap_begin,
> address_size_type *heap_size,
> address_size_type *sbrk_amount);
>
> However:
> 1. When would address_type not be void *?
Never, I think.
> 2. When would address_size_type not be size_t?
On some systems you may have sizeof(size_t) < sizeof(void *)? I don't know an
example.
--
Sebastian Huber, embedded brains GmbH
Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone : +49 89 18 90 80 79-6
Fax : +49 89 18 90 80 79-9
E-Mail : sebastian.huber at embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the users
mailing list