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

From: Mark J. Reed <markjreed1mail.com>
Date: 2008-03-06 02:04:37
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.






-- 
Mark J. Reed <markjreed@mail.com>
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Mar 6 02:04:43 2008

This archive was generated by hypermail 2.1.8 : 2008-03-06 02:04:48 CET