From: horseriver <horserivers@gmail.com>
To: Andrew Haley <aph@redhat.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: how to implement this ?
Date: Mon, 07 Jan 2013 15:44:00 -0000 [thread overview]
Message-ID: <20130107055724.GD26946@debian.localdomain> (raw)
In-Reply-To: <50EAE9F7.5040405@redhat.com>
On Mon, Jan 07, 2013 at 03:29:59PM +0000, Andrew Haley wrote:
> On 01/07/2013 05:39 AM, horseriver wrote:
> > On Mon, Jan 07, 2013 at 03:09:31PM +0000, Andrew Haley wrote:
> >> On 01/07/2013 05:11 AM, horseriver wrote:
> >>> On Mon, Jan 07, 2013 at 02:31:19PM +0000, Andrew Haley wrote:
> >>>> On 01/07/2013 04:46 AM, horseriver wrote:
> >>>>> hi:
> >>>>>
> >>>>> how to implement this assignment by MACRO?
> >>>>> int a,b,c ;
> >>>>>
> >>>>> ((a==0)?b:c)=8;
> >>>>
> >>>> This is for help with GCC, not general C coding help.
> >>>>
> >>>> *((a==0) ? &b : &c) = 8;
> >>>>
> >>>> But this is really horrible code. I wouldn't do it.
> >>>
> >>> thans!
> >>>
> >>> why gcc report that error ?
> >>>
> >>> gcc can translate " ((a==0)?b:c)=8 " into if-else sentence .
> >>>
> >>> wht is the reason ï¼
> >>
> >> Please supply the test case and the error message.
> >>
> >
> > ok
> >
> > here is this code :
> >
> > #define INPUT_KEYCODE(dev, scancode) ((dev->keycodesize == 1) ? ((u8*)dev->keycode)[scancode] : \
> > ((dev->keycodesize == 2) ? ((u16*)dev->keycode)[scancode] : (((u32*)dev->keycode)[scancode])))
> >
> > and here is the callee code :
> >
> > unsigned int keycode ;
> >
> > INPUT_KEYCODE(dev, scancode) = keycode;
> >
> > dev is a struct , scancode is a unsigned int
> >
> > and gcc report error is :
> >
> > error: lvalue required as left operand of assignment
>
> That is the wrong error.
>
> I need to see the whole of the code that resulted in the error that was
> "gcc can translate " ((a==0)?b:c)=8 " into if-else sentence ."
gcc can translate " ((a==0)?b:c)=8 " into if-else sentence
is my idea ,not a reported error
thanks!
>
next prev parent reply other threads:[~2013-01-07 15:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-07 14:31 horseriver
2013-01-07 14:53 ` Andrew Haley
2013-01-07 15:09 ` horseriver
2013-01-07 15:21 ` Andrew Haley
2013-01-07 15:25 ` horseriver
2013-01-07 15:35 ` Andrew Haley
2013-01-07 15:44 ` horseriver [this message]
2013-01-07 15:49 ` Andrew Haley
2013-01-07 15:52 ` horseriver
2013-01-07 17:05 ` Andrew Haley
2013-01-07 15:30 ugiwgh
2013-01-07 15:39 ` how " horseriver
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130107055724.GD26946@debian.localdomain \
--to=horserivers@gmail.com \
--cc=aph@redhat.com \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).