Just really ! The array arr has the type void ***, the cast happens on the 
first derefencing of arr. So the result remains a void **, which is for 
sure a pointer. This leads to a pointer truncation, 
therefore to a warning  and a build failure. It is clear, that the first 
element of the array arr is in fact the integer value of a type with 
sizeof(void *).
Wouldn't is better to have for this cast monster a structure. Something 
like 
        struct sFieldArray {
                size_t count;
                void *arr[1];
        }
?

Regards,
i.A. Kai Tietz




Richard Henderson <[EMAIL PROTECTED]> 
08.03.2007 19:08

To
Kai Tietz <[EMAIL PROTECTED]>
cc
Ian Lance Taylor <[EMAIL PROTECTED]>, gcc@gcc.gnu.org
Subject
Re: What does coding-style tells about integer types for pointers ?






On Thu, Mar 08, 2007 at 06:06:57PM +0100, Kai Tietz wrote:
> In gcc the file emutls.c assumes that a long has sizeof void * in 
function 
> emutls_destroy.

Not really.  It assumes you can store the size of the array
in min(sizeof(long), sizeof(void*)) bytes.



r~



Reply via email to