Re: NSString not working
Re: NSString not working
- Subject: Re: NSString not working
- From: Clark Cox <email@hidden>
- Date: Mon, 20 Apr 2009 19:45:54 -0700
On Mon, Apr 20, 2009 at 4:02 PM, Shawn Erickson <email@hidden> wrote:
> On Mon, Apr 20, 2009 at 3:23 PM, Clark Cox <email@hidden> wrote:
>> On Mon, Apr 20, 2009 at 12:49 PM, Shawn Erickson <email@hidden> wrote:
>>> On Mon, Apr 20, 2009 at 10:17 AM, Jeremy Pereira <email@hidden> wrote:
>>>
>>>> By inspection it is easy to tell tmp is null terminated and that it conforms
>>>> to the ISO Latin-1 encoding (seeing as it only contains ASCII characters).
>>>
>>> You are assuming the file encoding used for the file and/or the way
>>> gcc is told treat string constants will result in something conforming
>>> to ISO Latin-1. When compiled it could be 2 byte (or 4 byte) encoded
>>> for example.
>>
>> That is simply not true. There is no way that "Blah" will be anything
>> other than a 5-byte array with the following contents: {'B', 'l', 'a',
>> 'h', '\0'}.
>
> You can cause it to be something other then you may expect if you use
> -fexec-charset and I think I recall other ways.
Yes, but if you were to choose a non-8-bit charset, you would have
bigger problems when assigning such a string to a char array. The
result of "somestring" is always an array of characters, it is never
an array of anything larger than characters.
Additionally, regardless of the characterset, interpretation as
ISO-8859-1, unlike UTF-8, will always succeed (i.e. there are no
invalid bit-sequences in ISO 8859-1, everything will be interpreted as
*something*)
--
Clark S. Cox III
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden