Re: [cc65] Print heart character on C64?

From: Spiro Trikaliotis <ml-cc651trikaliotis.net>
Date: 2004-12-01 12:29:58
Hello Uz,

* On Wed, Dec 01, 2004 at 12:14:32PM +0100 Ullrich von Bassewitz wrote:
 
> >  sprintf(buffer, "M-W%c%c%c", 0x01, 0x02, 0x03);
[...]
 
> The above works, but it's quite some overhead, because the string is
> assembled at runtime, and sprintf is not exactly a lightweight
> function.

Yes, I know. In fact, sprintf() has many other problems, too. I have not
checked, but cc65 does not happen to have an snprintf() function? (I'm
curious to see the first exploit for a 6502 computer...)


> > Is this behaviour guaranteed from the C standard?
> 
> Which behaviour do you mean? If you mean character set translation, then the
> answer is that the standard allows it (see ISO/IEC 9899:1999 (E), "5.2.1
> Character sets").

Well, my question was: Does the standard guarantee that *only* strings
and character literals are converted? I fear some compilers trying to
convert the contents of a char variable (for example, if I use the above
sprintf(), my 0x01 would be translated!)

Anyway, I see, we're leaving the grounds of cc65 here.

Regards,
   Spiro.

-- 
Spiro R. Trikaliotis
http://www.trikaliotis.net/
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Dec 1 12:30:04 2004

This archive was generated by hypermail 2.1.8 : 2004-12-01 12:30:13 CET