Subject: Re: c++ warning...help?
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: gabriel rosenkoetter <gr@eclipsed.net>
List: tech-toolchain
Date: 07/01/2001 14:25:22
On Sun, Jul 01, 2001 at 02:17:46PM -0400, der Mouse wrote:
> >>> __asm__ ("addl %5,%1\n\tadcl %3,%0" :
> >>> "=r" ((USItype)( new_carry )), "=&r" ((USItype)( sum )) :
>
> There are two lvalues there: new_carry and sum. Note that they are
> *output* operands from the asm. As extend.texi says, "Output operand
> expressions must be lvalues". (The = operand constraint character is
> not an assignment operator, though likely it was chosen for its
> similarity to one. But output operands to extended asm statements
> function like assignment LHSes even though there is no explicit
> assignment operator present.)
>
> And sure enough, they're being cast.
>
> I think the compiler is exactly right. What am I missing?
Um, while I certainly can't argue with that (far more
knowledgeable) explanation, then does this code work (which it
apparently does) because:
1. The cast doesn't work and we just get lucky.
OR
2. The cast actually does work, so why worry.
If 2, then why's g++ bitching?
--
~ g r @ eclipsed.net