Re: [OFFTOPIC] Re: A bit off-topic ... (fwd)

Rivalino Matias Junior (rivalino@unoesc.rct-sc.br)
Wed, 31 Mar 1999 17:50:27 -0400 (AST)


On Wed, 31 Mar 1999, J. S. Connell wrote:

> First, let me say that this message is VASTLY offtopic for the linux-kernel
> mailing list. This mailing list is for discussion of the Linux kernel's
> internals - NOT about basic C programming.
Sorry.

>
> On Wed, 31 Mar 1999, Rivalino Matias Junior wrote:
> > The result of x is two. Why ?
>
> My C compiler won't compile that - it claims you're assigning to an invalid
> lvalue.
Okay. Try in C++ compiler (e.g. g++). I'm using g++ in this case.

>I suspect there's a compiler bug to do with assignments in a
> ternary operator as the rvalue of an assignment.

The expression is correct.

> Wrapping the two x='s on
> the right-hand side generates the expected output.
>
No. The expected output is X equal to the result of two other expression
(E1,E2), related to condition (y).
x= (condition) ? E1 : E2;

Regards,

RMJ.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/