might be a bug in the DMD FrontEnd

Deewiant deewiant.doesnotlike.spam at gmail.com
Fri Mar 30 01:30:07 PDT 2007


Daniel Keep wrote:
> Davidl wrote:
>> i don't see what prevent the following from compiling:
> 
> I can see a few things...

<...>

> cast(char)192, whilst technically valid, is really nasty.  For starters,
> '192' isn't a valid character by itself in UTF-8, which means it can't
> be printed.

<...>

> Please don't use printf, at least not without passing the string through
> toStringz.  writefln works perfectly fine.

Perhaps he's using printf because he wants to output the byte 192 without
getting an "Error: 4invalid UTF-8 sequence". I've found that, currently, in both
Phobos and Tango, the C library is the best way of outputting a character whilst
letting the user worry about whether he can see it properly in his locale or not.

The point about toStringz still stands, though.



More information about the Digitalmars-d mailing list