On 2010-01-05 20:50:38 +0000, Andrew Haley wrote:
> On 01/05/2010 07:58 PM, Joshua Haberman wrote:
> > Andrew Haley <aph <at> redhat.com> writes:
> >> but
> >>
> >>  (union u*)&i
> >>
> >> is not a legal lvalue expression because the dereference is undefined
> >> behaviour.
> > 
> > Your example does not contain a dereference.
> > 
> >> You may only dereference a pointer as permitted by 6.3.2.3.
> > 
> > 6.3.2.3 does not mention dereferencing at all; it only addresses pointer
> > conversion.  Dereferencing is defined in 6.5.3.2.

and I'd say that it is also covered by 6.2.6.1 (together with 6.5p7).

> > But let me ask you this.  What do you think 6.5 paragraph 7 means?  For
> > example, are you also of the opinion that this is illegal?
> > 
> >   int i;
> >   unsigned int *pui = (unsigned int*)&i;
> >   unsigned int ui = *pui;
> 
> That's covered by 6.3.2.3 Para 2.

This paragraph is about pointer conversion, not dereferencing.

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)

Reply via email to