[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiling Elisp to a native code with a GCC plugin

From: David Kastrup
Subject: Re: Compiling Elisp to a native code with a GCC plugin
Date: Fri, 17 Sep 2010 20:24:30 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

David Kastrup <address@hidden> writes:

> Andreas Schwab <address@hidden> writes:
>> David Kastrup <address@hidden> writes:
>>> Lars Magne Ingebrigtsen <address@hidden> writes:
>>>> Lars Magne Ingebrigtsen <address@hidden> writes:
>>>>> (looking-at (unibyte-string #x68 #xc3 #xa9 #x6c #x6c #x6f) t)héllo
>>>>> => t
>>>>> *scratches head*  Well, I guess I can see that...
>>>> I've looked at what Fequal does.  It first compares the number of
>>>> characters in the strings, and then the number of bytes, and then it
>>>> does a memcmp().
>>> It also checks that the multibyteness is the same IIRC.
>> If both the number of chars and bytes agree then they must be of the
>> same multibyteness.
> Why?
> (length (string-as-multibyte "h\251llo")) => 5
> (equal "h\251llo" (string-as-multibyte "h\251llo")) => nil

Just seen that string-as-multibyte actually _does_ convert the content
(did not use to do so pre-23).

So string equality indeed does not check explicitly for multibyteness
which is sort of ugly:

(equal "abc" (string-to-multibyte "abc")) => t
(string= "abc" (string-to-multibyte "abc")) => t
(multibyte-string-p "abc") => nil
(multibyte-string-p (string-to-multibyte "abc")) => t

So it is likely that the correct way to deal with the uni/multibyte
issue in the case of buffer/string comparison is the same: just check
that both character and byte counts are identical.

David Kastrup

reply via email to

[Prev in Thread] Current Thread [Next in Thread]