"Kaveh Ghazi" <[EMAIL PROTECTED]> writes: > Right, here's the original link where I mention it: > http://gcc.gnu.org/ml/gcc-patches/2008-06/msg01658.html > > This involves a cast from one type to another through a void*. I haven't > been able to convince myself that this is completely safe. If someone > understands why the code is violating type-safety intentionally and can > explain why it's always safe, I would be happy to insert the appropriate > cast and fix it.
The two types bitmap_element and bitmap_head share a common initial sequence, and when following through ->heads only the first pointer is ever used. If you define a union type containing the two structs and make it visible at any point using that cast that would make it completely safe to the letter of the standard (6.5.2.3#5). Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."