draft ANSI standard: one change that would *really* help Europe
John Cornelius
jc at piaget.UUCP
Sat Dec 13 12:35:17 AEST 1986
In article <2246 at eagle.ukc.ac.uk> sjl at ukc.ac.uk (S.J.Leviseur) writes:
>In article <300 at bms-at.UUCP> stuart at bms-at.UUCP (Stuart D. Gathman) writes:
>>In article <2221 at eagle.ukc.ac.uk>, sjl at ukc.ac.uk (S.J.Leviseur) writes:
>....
>>> If you want to see for yourself have a look through your sources and find
>>> every occurence of a comparision between EOF or -1, and a char. Typically,
>>> where cp is a character pointer:-
>>
>>> if (*cp == EOF)
>>
>>> while (*cp != EOF)
>>
>>Not in our code! This type of code is not likely to work, even under K & R.
>
>It will work on any machine that allows signed chars (despite being ideologically
>unsound!)
>
I believe that the 3B2, to pick an example, places char in the high order
byte of the register. If you test one for equality with (int) -1 you will
never pass the test.
As for small integers, Whitesmiths had a convention where a signed char
was typdef tiny char (in this case signed).
Because of the different architectures we're seeing in the Unix/C environment
I laud the effort to create a standard that is architecture independent.
As for the above construct working on any machine with signed char, I doubt
that it will work on the 3B2.
--
John Cornelius
(...!sdcsvax!piaget!jc)
More information about the Comp.lang.c
mailing list