Re: [cc65] A bug? (was: Questions for CBM guys)

From: <silverdr1inet.com.pl>
Date: 2008-03-07 01:32:22
On 2008-03-06, at 02:04, Mark J. Reed wrote:

> On Wed, Mar 5, 2008 at 5:56 PM,  <silverdr@inet.com.pl> wrote:
>> If that is defined exactly as you write in the current C standard,
>> then the question is of course invalid but it still surprises me. I
>> haven't read any specs on C. I learned it many years ago from K&R. It
>> was some time before C even get standardised but I must have learnt  
>> it
>> from K&R how \r behaves and I know that I relied on this behaviour
>> many times in the past and this was the first time I found it not
>> working as expected.
>
> Bear in mind that C was developed on UNIX, where the standard newline
> is a bare linefeed, and most terminals hooked up to early UNIX
> machines treated carriage return as you say.   So the assumption is
> somewhat inherent in the language's design, but it wasn't portable
> that way.
>
> Also, note that not all languages which use the C escape syntax have
> the same definitions.  In Java, "\n" is defined to mean U+000A LF and
> "\r" is U+000D CR, and to get the platform-dependent newline behavior
> you call println() instead of print().  As I mentioned, Perl has the
> same conventions as C but adds "\l" for linefeed to complete the
> trifecta.  Unfortunately, the use of the syntax has spread more widely
> than the habit of giving it a specific definition, so some languages
> behave unpredictably on non-UNIX platforms in this regard.

I understand, and as I wrote earlier - I don't challenge that if the  
modern C specs "do not require '\r' to have any particular effect".  I  
don't also really care about how Java, Perl, Ruby and other languages  
use C-style escape sequences but it's good to know for the possible  
future that I should rather check than assume blindly that those just  
have to work the way I expect them to.

Regards,

P.

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Mar 7 01:32:41 2008

This archive was generated by hypermail 2.1.8 : 2008-03-07 01:32:56 CET