home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / c / 18730 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  1.1 KB

  1. Path: sparky!uunet!mcsun!Germany.EU.net!horga!reswi!smart.bo.open.de!tom
  2. From: tom@smart.bo.open.de (Thomas Neumann)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: a ? b : c = d; /* legal ? */
  5. Date: 20 Dec 1992 14:06:18 GMT
  6. Organization: News at smart
  7. Lines: 23
  8. Message-ID: <1h1ukqINNodo@smart.bo.open.de>
  9. References: <BzDA4u.459@cdsmn.mn.org>
  10. NNTP-Posting-Host: smart.bo.open.de
  11. X-Newsreader: Emacs 18.59.1, GNUS 3.14.1
  12. In-reply-to: wells@cdsmn.mn.org's message of Wed, 16 Dec 1992 19:29:17 GMT
  13.  
  14. >>>>> Regarding a ? b : c = d; /* legal ? */; wells@cdsmn.mn.org (Rich Wells) adds:
  15.  
  16.   wells> Is the statement:
  17.  
  18.   wells>     a ? b : c = d;
  19.  
  20.   wells> where a, b, c, and d are all integers, a valid C expression?
  21.  
  22. You can do it like this
  23.  
  24.   int a, b, c, d;
  25.   *(a ? &b : &c) = d;
  26.  
  27. to force the lhs to be an lvalue.
  28.  
  29.   wells> So that I don't have to go out and buy an asbestos suit, I
  30.   wells> want to make it very clear that I would never even consider
  31.   wells> writing code like this. 
  32.  
  33. Why not ? It's a nice shortcut in some situations, and nobody with
  34. some knowledge of C should have problems reading the code.
  35.  
  36. bye  -- Thomas
  37.