Character and string literals

Norman Diamond diamond at diamond.csl.sony.junet
Tue Jul 11 10:57:07 AEST 1989


comp.lang.c has been added to the distribution of this followup.

Mr. Sommarskog tested the Eiffel compiler to see which characters are
accepted in character and/or string literals.  The Eiffel compiler
generates a portable assembly code (C of course) as intermediate code.

In article <102 at enea.se> sommar at enea.se (Erland Sommarskog) writes:

>  Now, what about the error the C compiler detected? The cause is
>the very last string, which contains character 255. (Which corre-
>sponds to lowercase dotted "y" in 8859/1.) Apparently the C compiler
>takes this end of file. (My knowledge of C and Unix is little, but
>isn't -1 often a code for end of file? And -1 and 255 is the same
>thing for a byte.)

Indeed yes.  There are periodic flamefests in comp.lang.c, reminding
C programmers that they should getchar() into a short or int, instead
of into a char, so that they can test the int value correctly against
the constant EOF, which is -1.  Looks like some programmer wrote a
C compiler without knowing how to use C.  (This happens a lot.)

--
Norman Diamond, Sony Computer Science Lab (diamond%csl.sony.jp at relay.cs.net)
 The above opinions are claimed by your machine's init process (pid 1), after
 being disowned and orphaned.  However, if you see this at Waterloo, Stanford,
 or Anterior, then their administrators must have approved of these opinions.



More information about the Comp.lang.c mailing list