Subject: Re: c++ warning...help?
To: gabriel rosenkoetter <gr@eclipsed.net>
From: Andrew Brown <atatat@atatdot.net>
List: tech-toolchain
Date: 06/23/2001 10:34:11
>> 	../include/LiDIA/kernel/udigit_interface.h:75: warning: \
>> 	ANSI C++ forbids cast to non-reference type used as lvalue
>
>Wow. g++ is totally confused. There's no kind of (C or C++) lvalue
>on that line. It really oughtn't even be doing checks for casting
>and such in asm code.

that's what i thought.

>> which the preprocessor turns into this (for line 71):
>> 
>> 	__asm__ ("addl %5,%1\n\tadcl %3,%0" :
>> 	"=r" ((USItype)( new_carry )), "=&r" ((USItype)( sum )) :
>				 ^^^^^^^^^^^^^a^^^^^^^^^^  ^b^
>
>The parser things (a) is a cast to the left of (b), which it
>believes in an assignment operator, making (a) an illegal cast in an
>lvalue.

oh, okay.

>Of course it's no such thing, since that particular = has nothing to
>do with assignment operator or, really, a C operator of any kind
>(assignment is the only time this kind of lvalue checking really
>matters).

so it's just the compiler overreacting.  or a bug, more like.

>> what i *don't* understand is what it's actually complaining about.
>> anyone?  please?
>
>Well, does the code compile? Run? If so, ignore that warning,
>because g++ is off its rocker to yield it. (Oh, um, I guess you'll
>have trouble if your Makefiles treat warnings as errors... but I
>can't think of a good way to block against that off the top of my
>head. Of course, I don't exactly toss asm() around very frequently,
>so maybe someone else will have a better idea.)

it seems to compile and run just find.  i wasn't using -Werror, so it
wasn't a particularly nasty warning, even though i can't make it go
away.

asm stuff in c...i used to do, when i was learning c and using
borland's i386 c compiler.  reading this just makes me go cross-eyed.

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
andrew@crossbar.com       * "information is power -- share the wealth."