Questions about C on a Prime (primix)
Root Boy Jim
rbj at icst-cmr
Wed Apr 9 09:36:29 AEST 1986
Any C implementation that insists on having the high bit set
for normal character (char)s should also treat (char) as
(unsigned char), or else there will be sign-propagation
constants when (char)s are widened to (int). Otherwise,
this is a permissible (although unusual) implementation choice.
Both K&R & the ANSI standard say that a printing character is
guaranteed to be positive. If the implementation (hardware) insists on
characters with the high order bit set, then my guess is that it must
be done in very low level code, possibly within putc just before
the char is sent to the device. Varian 620i (sounds like a BMW)
aka V-7x's wanted this as I seem to recall.
In any case, the following program must print `positive', for any
printing character 'x'.
main()
{ char c;
c = 'x'
if (c > 0)
printf("positive\n");
else printf("netative\n");
}
References: K&R page 183 sect 6.1
(4/30/85) ANSI page 16 sect C.1.2.5
More information about the Comp.lang.c
mailing list