Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@zoo.toronto.edu (Henry Spencer)
Subject: Re: Special character constants
Message-ID: <1991Jan16.174248.2689@zoo.toronto.edu>
Organization: U of Toronto Zoology
References: <1292@mti.mti.com>
Date: Wed, 16 Jan 1991 17:42:48 GMT

In article <1292@mti.mti.com> adrian@mti.UUCP (Adrian McCarthy) writes:
>...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?

They must have *some value* distinct from each other and from printable
characters.  In general, I think you are confusing the character set with
the output devices.  An ASCII tab character is still a tab character even
if a particular output device does not do anything useful with it.  Almost
every modern machine uses ASCII or some variant thereon, so the characters
almost invariably exist in the character set.

>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.

Bear in mind that the definition of what an output device *does* with a
tab is very device-dependent.  Just having tabs "available" is not enough;
you need to know exactly how they are processed.  Short of using a library
like termcap or curses, if you want precise output appearance without any
prior knowledge of hardware or software, you're going to have to use
spaces regardless.
-- 
If the Space Shuttle was the answer,   | Henry Spencer at U of Toronto Zoology
what was the question?                 |  henry@zoo.toronto.edu   utzoo!henry
