Efficiency Question

Thomas Kwong 6600tom at ucsbuxa.ucsb.edu
Wed Feb 27 06:07:08 AEST 1991


In article <4bmBqau00Uh_M0aHgb at andrew.cmu.edu> rg2c+ at andrew.cmu.edu (Robert Nelson Gasch) writes:

>Since C gives you the opportunity to condense statements, I was wondering
>what difference to the compiler these 'shortcuts' make. 

>For example, you can write:
>   if (x > y)
>       z = x;
>   else
>       x = y;
        ^^^^^
>The same thing can be expressed like this:
>   z = (x > y) ? x : y;

Nope.  It should be
    if (x > y)
	z = x;
    else
	z = u;

-Thomas.

============================================================
     o      |        *   -------------------------
   -----    |-       *   tomkwong at cs.ucsb.edu
     \/     |        *   6600tom at ucsbuxa.ucsb.edu 
  --------  --       *   -------------------------
     __       |      *   
    |  |   |--       *   "The more one think he knows,
    |--|   |--       *    the less he knows."
    |--|   |--       *                       -Menocchio
    |  |   |--       *   "Are you proud of being Chinese?" 
      \|   ------\   *   I say, "Sure, always!"   :-)
============================================================
--

Thomas.

============================================================



More information about the Comp.lang.c mailing list