[cc65] strcmp to empty string

From: Shawn Jefferson <sjefferson1shaw.ca>
Date: 2010-01-08 08:37:02
Hi,

 

It never occurred to me to not use strcmp(str, "") == 0 to check for an
empty string!  I just converted all these to checks of the first character
of the ( string str[0] == '\0' and str[0] != '\0' ) and saved 341 bytes in
my program, plus probably made it a bit faster to execute as well.  There
shouldn't be any issue doing it this way?  I don't think there is.

 

Just a tip for anyone using cc65 that is used to doing things this way.

 

Using this optimization and creating some static zeropage variables instead
of register variables, I dropped about 785 bytes in total from the program.

 

-- 

Shawn



----------------------------------------------------------------------
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 Jan 8 08:37:10 2010

This archive was generated by hypermail 2.1.8 : 2010-01-08 08:37:13 CET