On Monday, Sep 23, 2002, at 18:15 US/Pacific, Timothy J. Wood wrote:

>
> On Monday, September 23, 2002, at 03:52  PM, Zem wrote:
>>      length = TREE_STRING_LENGTH (str) - 1;
>>   +  if (warn_nonportable_cfstrings)
>>   +    {
>>   +      char *s = TREE_STRING_POINTER (str);
>>   +      int l = 0;
>>   +
>>   +      while (l < length && isascii (s[l])) l++;
>>   +      if (!isascii (s[l]))
>>   +  warning ("non-ASCII characters in CFString literal");
>>   +    }
>
>
>   Maybe there is a good reason for this, but I always prefer to write 
> non-tricky code.   So, I'd write this more like:
>
>       for (l = 0; l < length; l++) {
>               if (!isascii(s[l])) {
>                       warning("non-ASCII characters in CFString literal");
>                       break;
>               }
>       }

That's a good suggestion, thanks!  I'll apply it to the sources.

>
>   The original implementation will call isascii() on the trailing null 
> twice (I think).  At any rate, the second implementation is more > clear.
>
>   Finally, it seems like it would be good to get a warning about 
> embedded nulls in CFString literals -- I know of no case where this is 
> valid.

I'll forward this to our Foundation gurus -- I have no opinion on this 
myself.

As always, thanks for your feedback!

--Zem
--------------------------------------------------------------
Ziemowit Laski                 1 Infinite Loop, MS 301-2K
Mac OS X Compiler Group        Cupertino, CA USA  95014-2083
Apple Computer, Inc.           +1.408.974.6229  Fax .5477

Reply via email to