[comp.lang.eiffel] Error in character constant

jos@cs.vu.nl (11/10/89)

Version: ISE Eiffel, version 2.2, level A, SUN4/sparc

The eiffel compiler does not handle the character constant '#'
correctly.  Incorrect C code is generated.
Consider the following class:

============================================================
class CHAR_CONST export

feature

    REP_CHAR : CHARACTER is '#';

    str   : STRING is "appeltje";

    Create is
    local
	rep   : INTEGER;
    do
	rep := str.search_char(REP_CHAR, 1);
    end
end
============================================================
Calling es gives the following output:

Eiffel compilation manager
   (version 2.2 level A)
Pass 1 on class char_const
Pass 2 on class char_const
	Interface has not changed.
Pass 3 on class char_const
"char_const", 13: Warning: search_char is obsolete:  Use ``index_of''
Pass 4 on class char_const
C-compiling char_const
char_const.c: 42: CALL: argument mismatch
"char_const.c", line 42: syntax error at or near symbol ,
"char_const.c", line 42: newline in string or char constant
"char_const.c", line 43: too many characters in character constant
es: C-compilation canceled

============================================================

If the constant character is changed to '1', everything works just fine.


                                 Jos Warmer
				 jos@cs.vu.nl
				 ...uunet!mcvax!cs.vu.nl!jos