Escape codes are not 100% portable

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 2 04:55:09 PDT 2015


i know that such compilers do exist. i just don't believe that making 
workarounds for broken compilers is the right way to go.

'\n' is defined as "new line", which in turn defined as "\x0a" in ASCII 
table. and '\r' is defined as "carriage return", which in turn is defined 
as "\x0d" in ASCII table. any C/C++ compiler that claims to work 
correctly on a system which supports ASCII table should have that 
correspondence.

more than that: if host system using another character encoding, '\n' and 
'\r' will still be valid chars for "new line" and "carriage return". 
using hex codes instead of escapes will break text file reading on such 
systems.

so your suggestion actually *introduces* the bug in DMD.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150402/72b9271e/attachment.sig>


More information about the Digitalmars-d mailing list