Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-08-15 15:21:31


I don't see what point you're trying to make. The stuff you've quoted
doesn't change anything. (T*)1 is either undefined or unspecified behavior
for any T you choose; I forget which.

-----------------------------------------------------------
           David Abrahams * Boost Consulting
dave_at_[hidden] * http://www.boost-consulting.com

From: "Philippe A. Bouchard" <philippeb_at_[hidden]>
> Given:
>
> 5.3.3.1:
> - "The sizeof operator yields the number of bytes in the object
> representation of its operand."
> - "sizeof(char), sizeof(signed char) and sizeof(unsigned char) are 1."
>
> 5.2.10.7:
> - "Except that converting an rvalue of type "pointer to T1" to the type
> "pointer to T2" (where T1 and T2 are object types and where the
alignment
> requirements of T2 are no stricter than those of T1) and back to its
> original type yields the original pointer value"
>
>
> struct T { ... };
> struct U : T { ... };
>
> k = ptrdiff_t((char *) (T *) (U *) 1 - (char *) 1)
> K is some constant
>
>
> Temporarily unspecified:
> m_ptr = (char *) (U *) value - (char *) k
>
> When dereferenced:
> m_ptr = (U *) ((char *) (U *) value - (char *) k + (char *) k)
Char
> alignment is less stricter than U
> = (U *) ((char *) (U *) value - (char *) 0)
> = (U *) ((char *) (U *) value)
> = (U *) value
> 5.2.10.7 applies
>
>
>
> Philippe A. Bouchard
>
>
>
>
>
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk