Special character constants

Doug Gwyn gwyn at smoke.brl.mil
Wed Jan 16 09:47:09 AEST 1991


In article <1292 at mti.mti.com> adrian at mti.UUCP (Adrian McCarthy) writes:
>I only have K&R2, not the Standard.  On a machine whose character set does
>not support special characters like tab and backspace, what happens to
>character constants like '\t' and '\b'?  Is there some special value they
>get set to (e.g., ' ' or '\0') instead?  Or is this issue left undefined?

A conforming implementation MUST provide distinct character values for these.
However, it is not absolutely required to force I/O devices to handle them in
the intended way.

>I'd like to keep some code I'm writing portable to many machines by using
>tabs if they are available and emulating them with spaces if they are not.

Just use spaces.  If you really have to deal with such variations, there
are numerous other environmental variations you should also take care of,
and these lie outside the scope of standard C.



More information about the Comp.lang.c mailing list