home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!uunet.ca!geac!zooid!ross
- From: Ross Ridge <ross@zooid.guild.org>
- Subject: Re: why does #define Ctrl(c) c&037 work ?
- Organization: ZOOiD BBS
- Distribution: worrrld
- Date: Sun, 16 Aug 1992 22:40:49 GMT
- Message-ID: <1992Aug16.224049.23485@zooid.guild.org>
- References: <1992Aug12.133132.10723@Princeton.EDU> <BRANNON.92Aug12164222@stun4r.cs.caltech.edu> <1992Aug13.133959.21908@news2.cis.umn.edu>
- Lines: 34
-
- fin@unet.umn.edu (Craig A. Finseth) writes:
- >The "correct" macro should be:
- >
- >#define Ctl(c) ((c)^'@')
- >
- >Which works for all of the above, and ? too.
- >
- >On the other hand, the GNU form picks up the lower case letters (as in
- >^a), but I at least would consider that usage to be silly, and
- >certainly not worth giving up ^? for.
-
- The macro is pretty bogus to begin with. It only exists because
- it used to be:
-
- #define Ctl(c) ('c'&037)
-
- While unportable and just as bogus, it was at least convienent. eg:
-
- char eof = Ctl(D);
-
- Otherwise you might as well just do:
-
- #define CTL_A '\001'
- ...
- #define ESC '\033'
- ...
-
- Ross Ridge
-
- --
- Ross Ridge - The Great HTMU l/ //
- [OO][oo]
- ross@zooid.guild.org /()\/()/
- uunet.ca!zooid!ross db //
-