Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!apple!oliveb!pyramid!prls!philabs!phri!marob!cowan From: cowan@marob.masa.com (John Cowan) Newsgroups: comp.lang.eiffel Subject: Re: Character and string literals Message-ID: <24CDEFD8.4754@marob.masa.com> Date: 26 Jul 89 17:07:36 GMT References: <102@enea.se> <10527@socslgw.csl.sony.JUNET> Reply-To: cowan@marob.masa.com (John Cowan) Organization: ESCC, New York City Lines: 49 In article <10527@socslgw.csl.sony.JUNET> diamond@csl.sony.junet (Norman Diamond) writes: >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@enea.se> sommar@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.) On the other hand, it would be better for the Eiffel compiler to emit the sequence "\377" in this case, rather than the character itself. No C program should contain characters from outside the C character set. It's not illegal, merely a poor idea. i n e w s i s a f a s c i s t -- Internet/Smail: cowan@marob.masa.com Dumb: uunet!hombre!marob!cowan Fidonet: JOHN COWAN of 1:107/711 Magpie: JOHN COWAN, (212) 420-0527 Charles li reis, nostre emperesdre magnes Set anz toz pleins at estet in Espagne.