Escape codes are not 100% portable

Jens Bauer via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 2 06:05:32 PDT 2015


On Thursday, 2 April 2015 at 12:24:22 UTC, Kagamin wrote:
> On Thursday, 2 April 2015 at 11:42:50 UTC, Jens Bauer wrote:
>> On the other hand, if a file was copied to a platform, where 
>> \r = 13 and \n = 10, and the file contains lines ending in 
>> 0x0d, then this compiler would not be able to build the file.
>
> Where it will fail? It can see extra lines, but those are 
> whitespace, the source should compile just fine.

You're right here; because the D compiler does not require 
reading line-by-line.
The line numbers reported will be incorrect, but that's probably 
the worst that can happen.

However, in a case like PPM (Portable Pixmap Format), the problem 
is that when the first \n character is met, the format switches 
to binary; but that will not occur until we've already read a 
bunch of bytes from the binary stream, resulting in the picture 
being out of sync.


More information about the Digitalmars-d mailing list