home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1989 …il & Dave's Excellent CD / Excellent CD HFS.raw / Moof / Goodies / DTS Goodies / Obfuscated_C / 1987 / korn.hint < prev    next >
Encoding:
Text File  |  1989-04-13  |  1.4 KB  |  45 lines  |  [TEXT/MPS ]

  1. Best One Liner: <ulysses!dgk> David Korn
  2.  
  3.     David Korn
  4.     AT&T Bell Labs
  5.     MH 3C-526B, AT&T Bell Labs
  6.     Murray Hill, NJ
  7.     07974
  8.     USA
  9.  
  10. The Judges believe that this is the best one line entry ever received.
  11. Compile on a UN*X system, or at least using a C implementation that
  12. fakes it.  Very few people are able to determine what this program
  13. does by visual inspection.  I suggest that you stop reading this
  14. section right now and see if you are one of the few people who can.
  15.  
  16. Several points are important to understand in this program:
  17.  
  18.     1) What is the symbol `unix' and what is its value in the program?
  19.        Clearly `unix' is not a function, and since `unix' is not declared
  20.        to be a data type (such as int, char, struct foo, enum, ...)
  21.        what must `unix' be?
  22.  
  23.     2) What is the value of the symbol "have"?  (hint: the value is
  24.        NOT 4 characters, or 'h', or a string)  Consider the fact that:
  25.  
  26.         char *x;
  27.  
  28.       defines a pointer to a character (i.e. an address), and that
  29.       the `=' assigns things is compatible types.  Since:
  30.  
  31.             x = "have";
  32.  
  33.       is legal C, what type of value is "have"?
  34.  
  35.     3) Note that the following expressions yield the same value:
  36.  
  37.         x[3]    *(x+3)      *(3+x)
  38.  
  39.        since addition is communitive.  What can be said about the value:
  40.  
  41.         3[x]
  42.  
  43. David Korn's /bin/ksh provides us with a greatly improved version of
  44. the /bin/sh.  The source for v7's /bin/sh greatly inspired this contest.
  45.