Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Re: LHS casting

Reply
Thread Tools

Re: LHS casting

 
 
Eric Sosman
Guest
Posts: n/a
 
      03-03-2013
On 3/3/2013 8:40 AM, Russell Shaw wrote:
> Hi,
> gcc-4.7 -pedantic accepts:
>
> (*(volatile int *) 0x20) = 0;
>
>
> I fail to see how in N1570:
>
> assignment-expression:
> conditional-expression
> unary-expression assignment-operator assignment-expression
>
> unary-expression:
> postfix-expression
> ++ unary-expression
> -- unary-expression
> unary-operator cast-expression
> sizeof unary-expression
> sizeof ( type-name )
> _Alignof ( type-name )
>
> unary-operator: one of
> & * + - ~ !
>
> cast-expression:
> unary-expression
> ( type-name ) cast-expression
>
>
> I can't see any extension in "info gcc".


If it's the extra set of parentheses that troubles you,
here's how they vanish:

assignment-expression:
unary-expression assignment-operator assignment-expression

unary-expression:
postfix-expression

postfix-expression:
primary-expression

primary-expression:
( expression )

Assuming that the `expression' in the final production can
be any of the more specialized kinds of expression (if there's
an explicit production to that effect I've overlooked it, but I
feel safe in relying on 6.5.1p5), the redundant parentheses have
been accounted for and you've got the equivalent of

*(volatile int*) 0x20 = 0;

If that's still a puzzlement, please describe your puzzlement
at greater length.

--
Eric Sosman
http://www.velocityreviews.com/forums/(E-Mail Removed)d
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: LHS casting Keith Thompson C Programming 0 03-03-2013 06:10 PM
Re: LHS casting Shao Miller C Programming 0 03-03-2013 02:44 PM
Operator overloading - lhs, rhs? C++ 5 01-31-2006 10:32 PM
Operator overloading - lhs, rhs? C++ 1 01-31-2006 04:41 AM
Adding a LHS menu to a layout which other elements won't wrap around. Hardeep Rakhra HTML 3 02-07-2004 12:34 PM



Advertisments