home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!rsg1.er.usgs.gov!news.cs.indiana.edu!umn.edu!unet.umn.edu!fin
- From: fin@unet.umn.edu (Craig A. Finseth)
- Subject: Re: why does #define Ctrl(c) c&037 work ?
- Message-ID: <1992Aug17.143156.28313@news2.cis.umn.edu>
- Sender: news@news2.cis.umn.edu (Usenet News Administration)
- Nntp-Posting-Host: norge.unet.umn.edu
- Organization: University of Minnesota, Networking Services.
- References: <1992Aug12.133132.10723@Princeton.EDU> <BRANNON.92Aug12164222@stun4r.cs.caltech.edu> <1992Aug13.133959.21908@news2.cis.umn.edu> <1992Aug16.224049.23485@zooid.guild.org>
- Distribution: worrrld
- Date: Mon, 17 Aug 1992 14:31:56 GMT
- Lines: 25
-
- In article <1992Aug16.224049.23485@zooid.guild.org>, Ross Ridge <ross@zooid.guild.org> writes:
- |> 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.
-
- |> 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'
- |> ...
-
- Except, of course, if you are trying to do:
-
- int x = 'A';
- int y;
-
- y = Ctl(x);
-
- Craig
-