Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site wanginst.UUCP Path: utzoo!linus!wanginst!vishniac From: vishniac@wanginst.UUCP (Ephraim Vishniac) Newsgroups: net.lang.c Subject: Re: ? : operator in lvalue Message-ID: <486@wanginst.UUCP> Date: Wed, 17-Apr-85 13:37:51 EST Article-I.D.: wanginst.486 Posted: Wed Apr 17 13:37:51 1985 Date-Received: Sat, 20-Apr-85 05:25:08 EST References: <704@mako.UUCP> Distribution: net Organization: Wang Institute, Tyngsboro, Ma. 01879 Lines: 24 > Is it considered kosher to use the ``? :'' operator > in computing an lvalue, as in > > int a, b, c; > > *(a ? &b : &c) = 47; > > This is certainly legal C, but I never recall > seeing it used in any code I have looked at. Legality may not be enough: some C compilers will choke on it anyway. I recently discovered that the Mark Williams C compiler (for 8086/8088) refuses to accept: int a[3], b; a[ b ? 1 : 2] = 47; It complains that the stuff on the left of the assignment is not an lvalue. -- Ephraim Vishniac [apollo, bbncca, cadmus, decvax, harvard, linus, masscomp]!wanginst!vishniac vishniac%Wang-Inst@Csnet-Relay