[net.lang.c] '\^Q' as an escape for control characters

reb@nbires.UUCP (06/03/83)

In the internal documentation for Gosling's EMACS, it mentions that EMACS'
use of '\' in character strings follows that of C, but then goes on
to give an example for control-X as the **three** char sequence \^X !

K&R makes no mention of this notation and our C compiler (4.1BSD)
does not accept it, as the two character sequence ^X is produced.

Does anybody know if this is a new/future extension to C, available only
in some implementations of C, an error in the EMACS documentation,
an EMACS extension, or what?

BTW, it seems to me that this is a much more reasonable way to represent
infrequently used control characters than \nnn!

					Thanks,
					Roy Binz

					ucbvax!nbires!reb
					allegra!nbires!reb
					hao!nbires!reb

mark@cbosgd.UUCP (06/06/83)

The ^X notation is very useful in ASCII, but meaningless in some
other character set.  C does not assume ASCII (although it does
assume a newline character, which is a pretty significant assumption).
There is an EBCDIC implementation of C.  Thus, the octal escape seems
like a more appropriate mechanism, although it is a pain for us programmers.
You could always use
	#define CTRL(x) ('x' & 037)

As to the EMACS documentation, why do you assume that \^X is a 3
character sequence?  I would interpret that as the two character
sequence backslash control-X (since, for typographical reasons,
it's hard to print a control X character on a piece of paper).