home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / c / 12407 < prev    next >
Encoding:
Text File  |  1992-08-16  |  1.2 KB  |  46 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!uunet.ca!geac!zooid!ross
  3. From: Ross Ridge <ross@zooid.guild.org>
  4. Subject: Re: why does #define Ctrl(c) c&037 work ?
  5. Organization: ZOOiD BBS
  6. Distribution: worrrld
  7. Date: Sun, 16 Aug 1992 22:40:49 GMT
  8. Message-ID: <1992Aug16.224049.23485@zooid.guild.org>
  9. References: <1992Aug12.133132.10723@Princeton.EDU> <BRANNON.92Aug12164222@stun4r.cs.caltech.edu> <1992Aug13.133959.21908@news2.cis.umn.edu>
  10. Lines: 34
  11.  
  12. fin@unet.umn.edu (Craig A. Finseth) writes:
  13. >The "correct" macro should be:
  14. >
  15. >#define Ctl(c) ((c)^'@')
  16. >
  17. >Which works for all of the above, and ? too.
  18. >
  19. >On the other hand, the GNU form picks up the lower case letters (as in
  20. >^a), but I at least would consider that usage to be silly, and
  21. >certainly not worth giving up ^? for.
  22.  
  23. The macro is pretty bogus to begin with.  It only exists because
  24. it used to be:
  25.  
  26.     #define Ctl(c) ('c'&037)
  27.  
  28. While unportable and just as bogus, it was at least convienent.  eg:
  29.  
  30.     char eof = Ctl(D);
  31.  
  32. Otherwise you might as well just do:
  33.  
  34.     #define CTL_A    '\001'
  35.     ...
  36.     #define ESC    '\033'
  37.     ...
  38.  
  39.                             Ross Ridge
  40.  
  41. -- 
  42. Ross Ridge - The Great HTMU                         l/     //
  43.                                     [OO][oo]
  44. ross@zooid.guild.org                            /()\/()/
  45. uunet.ca!zooid!ross                             db     //
  46.