Re: [cc65] strcmp to empty string

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2010-01-08 18:56:27
On Thu, Jan 07, 2010 at 11:37:02PM -0800, Shawn Jefferson wrote:
>    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.

No, both methods are ok. Actually, cc65 could rewrite calls to strcmp this way
if one of the arguments is the empty string. I will have a look at that.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
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 18:56:44 2010

This archive was generated by hypermail 2.1.8 : 2010-01-08 18:56:47 CET