iiitsh@cybaswan.UUCP (Steve Hosgood) (08/18/89)
I never noticed until last night that the conditional operator:
<condition>? <val1>: <val2>
..is not a valid lvalue, even if both <val1> and <val2> are lvalues!
I wanted to say:
(flag > 0? foo: bar) = <complex expression>;
..which didn't work, needless to say. I had to employ a temporary variable
and an 'if' statement in the end :-(.
Is there a good reason for this behaviour?
Thanks in advance
Steve
-----------------------------------------------+------------------------------
Steve Hosgood BSc, | Phone (+44) 792 295213
Image Processing and Systems Engineer, | Fax (+44) 792 295532
Institute for Industrial Information Techology,| Telex 48149
Innovation Centre, University of Wales, | JANET: iiitsh@uk.ac.swan.pyr
Swansea SA2 8PP | UUCP: ..!ukc!cybaswan!iiitsh
-----------------------------------------------+------------------------------
My views are not necessarily those of my employers!
Please note the change in my username as of 1 Aug '89jfh@rpp386.Dallas.TX.US (John F. Haugh II) (08/22/89)
In article <612@cybaswan.UUCP> iiitsh@cybaswan.UUCP (Steve Hosgood) writes: >I never noticed until last night that the conditional operator: > ><condition>? <val1>: <val2> > >..is not a valid lvalue, even if both <val1> and <val2> are lvalues! >I wanted to say: > >(flag > 0? foo: bar) = <complex expression>; > >..which didn't work, needless to say. I had to employ a temporary variable >and an 'if' statement in the end :-(. There is a way to do this ... *((type_of_foobar *) flag > 0 ? &foo:&bar) = <complex expression> -- John F. Haugh II +-Quote of the month club: ------------ VoiceNet: (512) 832-8832 Data: -8835 | Speaking of Netnews Administration: InterNet: jfh@rpp386.cactus.org | "If Bill Vajk can do it, anyone can" UUCPNet: {texbell|bigtex}!rpp386!jfh +--------- -- Patricia O Tuama-----