[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Easy removals: B



Bastian Blank <waldi@debian.org> writes:

> On Mon, May 29, 2006 at 04:27:24AM +0200, Goswin von Brederlow wrote:
>> Pointer should be put into intpointer_t if you must.
>
> It is intptr_t from stdint.h.

Right, sorry. too late at night.

>>                                                      Or better make a
>> union of int and pointer if you have to mix the two.
>
> This is undefined behaviour, don't do it.

Unions are perfectly defined. Do you mean that if you assign a pointer
to such a union the int will be undefined and vice versa? That is true
but the code should never put a pointer in there and then use it as
an int. That is undefined with intptr_t as well. The only thing you
can safely do with a pointer cast to an integer is to cast it back.

> Bastian

MfG
        Goswin



Reply to: