[bitc-dev] bug in character decode routines

Jonathan S. Shapiro shap at eros-os.org
Wed May 17 10:33:08 EDT 2006


Sam:

It would be helpful to have an example.

I suspect the answer is that Swaroop is emitting character constants
incorrectly -- the algorithm in this case should be:

	if (c < 255 && isprint(c)) printf("'%c'", c);
        else printf("%d", c);

However, in strings we are encoding the UTF-8 code points into the
character constant directly, and this requires that we emit octal
escapes inside string literals.

So: are you looking at a string literal or a character initialization?

shap

On Wed, 2006-05-17 at 10:31 +0100, Sam Mason wrote:
> On Mon, May 15, 2006 at 02:38:29PM -0400, Jonathan S. Shapiro wrote:
> > The bigger issue here is unicode characters, which we haven't got a good
> > answer for yet.
> 
> I can't comment on the wider issues, but I'm slightly confused as to why
> the code generator outputs characters as C chars as opposed to integers.
> For example #\a gets compiled to '\141', whereas I'd expect it to just
> end up as the number 97.  I guess I'm missing something!
> 
> 
>   Sam
> _______________________________________________
> bitc-dev mailing list
> bitc-dev at coyotos.org
> http://www.coyotos.org/mailman/listinfo/bitc-dev



More information about the bitc-dev mailing list