Re: [cc65] octal character constants bug (again :=P)

Date view Thread view Subject view

From: Groepaz (groepaz_at_gmx.net)
Date: 2003-09-30 22:46:28


On Tuesday 30 September 2003 22:34, Ullrich von Bassewitz wrote:
>     5.2.1 Character sets
[...]
> I would interpret this as if the current behaviour of cc65 is correct. It's
> also easy to remember: Any character or string constant is translated into
> the target character set.

ok, thanx 

> If you don't want the translation, don't use character constants. For
> binary data it is not a good idea to use character constants, why not just
> use numbers:
>
>         printf("%3d : %3d\n",010,8);
>
> works as expected.

yesyes.... i just have seen that type of stuff pretty often, mostly in old DOS 
programs :=)

> Not exactly. Two characters of the source character set may be translated
> into the same character of the execution character set. But you check will
> be ok.

so a character does not necessarily have a unique binary representation (more 
than one character may be mapped to the same binary value), right? mmmh... i 
feel like this is problematic... a comment in cq243.c says

" Since the value of a character constant is the numerical value
  of the character in the machine's character set, there should
  be a one-to-one correspondence between characters and values. " 
[note: i think this is founded on the fact that 'a' != 'b' != 'c' etc, it may 
be true only for printable characters?]

however, cc65 passes the test that follows the comment, so maybe the comment
itself isnt 100% accurate either :=P

> The represenation of character like \n depends on the target platform, so a
> check like ('\n' == '\101') depends on the target platform.

mmmh ok. but they are all supposed to be "non printable" (as in isprint()) ?! 
and those *are* supposed to map to unique binary values? or not? :=)

gpz


----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-09-30 22:51:54 CEST