[comp.lang.c] ANSI character escapes

karl@haddock.ISC.COM (Karl Heuer) (10/23/87)

Henry Spencer writes:
|For those barbarous folk who prefer hexadecimal to octal (God clearly meant
|man to use octal, the thumbs are parity bits), X3J11 has added hex string
|escapes.

No, God clearly meant Man to use hex, storing one nibble on the non-thumb bits
of each hand.

Dan Tilque replies:
>What's the format of these hex string escapes?

"\x" followed by hex digits.  This was originally going to be limited to three
digits (which allows for implementations having up to 12-bit chars), but last
I heard X3J11 was going to make them unlimited.  I believe unlimited is the
better choice, but I think the syntax should include an option to forcibly
terminate the character: "\x(1B)A" for ESC-A.

I know I could write "\x1B""A", but I also want to be able to write '\x(1B)A'
(multi-byte character constants are implementation-defined but not illegal).
Moreover, programs other than the C compiler already accept C-like escapes and
will likely pick up the new mnemonics; it's unreasonable to expect them all to
have string pasting too.

Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint