From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stephen J. Turnbull" Newsgroups: gmane.emacs.devel Subject: Re: Compiling Elisp to a native code with a GCC plugin Date: Sat, 18 Sep 2010 03:53:27 +0900 Message-ID: <87hbhoxkuw.fsf@uwakimon.sk.tsukuba.ac.jp> References: <87bp805ecr.fsf@gmail.com> <87iq26z97e.fsf@uwakimon.sk.tsukuba.ac.jp> <87y6b0yi8o.fsf@uwakimon.sk.tsukuba.ac.jp> <87sk18bioh.fsf@lola.goethe.zz> <87fwx8bhkq.fsf@lola.goethe.zz> <8739t8bepl.fsf@lola.goethe.zz> <87tylo9vou.fsf@lola.goethe.zz> <87pqwc9tnm.fsf@lola.goethe.zz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1284750032 8873 80.91.229.12 (17 Sep 2010 19:00:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 17 Sep 2010 19:00:32 +0000 (UTC) Cc: emacs-devel@gnu.org To: David Kastrup Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 17 21:00:31 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OwgAg-0001Ls-RN for ged-emacs-devel@m.gmane.org; Fri, 17 Sep 2010 21:00:31 +0200 Original-Received: from localhost ([127.0.0.1]:40853 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OwgAg-0003nZ-CU for ged-emacs-devel@m.gmane.org; Fri, 17 Sep 2010 15:00:30 -0400 Original-Received: from [140.186.70.92] (port=45873 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OwgAX-0003lc-00 for emacs-devel@gnu.org; Fri, 17 Sep 2010 15:00:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OwgAV-0004dV-To for emacs-devel@gnu.org; Fri, 17 Sep 2010 15:00:20 -0400 Original-Received: from imss12.cc.tsukuba.ac.jp ([130.158.254.161]:49150) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OwgAU-0004cx-6k; Fri, 17 Sep 2010 15:00:18 -0400 Original-Received: from imss12.cc.tsukuba.ac.jp (imss12.cc.tsukuba.ac.jp [127.0.0.1]) by postfix.imss70 (Postfix) with ESMTP id EEBAAF4003; Sat, 18 Sep 2010 04:00:15 +0900 (JST) Original-Received: from mgmt1.sk.tsukuba.ac.jp (unknown [130.158.97.223]) by imss12.cc.tsukuba.ac.jp (Postfix) with ESMTP id D84B7F4002; Sat, 18 Sep 2010 04:00:15 +0900 (JST) Original-Received: from uwakimon.sk.tsukuba.ac.jp (uwakimon.sk.tsukuba.ac.jp [130.158.99.156]) by mgmt1.sk.tsukuba.ac.jp (Postfix) with ESMTP id D32A43FA0135; Sat, 18 Sep 2010 04:00:15 +0900 (JST) Original-Received: by uwakimon.sk.tsukuba.ac.jp (Postfix, from userid 1000) id 42D161A3A8A; Sat, 18 Sep 2010 03:53:27 +0900 (JST) In-Reply-To: <87pqwc9tnm.fsf@lola.goethe.zz> X-Mailer: VM undefined under 21.5 (beta29) "garbanzo" ed3b274cc037 XEmacs Lucid (x86_64-unknown-linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:130356 Archived-At: David Kastrup writes: > > If both the number of chars and bytes agree then they must be of > > the same multibyteness. > > Why? Actually, there's an exceptional case: if both strings are pure ASCII. In that case it might be possible that one string is multibyte and the other unibyte, while the numbers of characters and of bytes are equal. However, in that case the two strings have the same semantics, so I would suspect that allowing them to compare equal if their representations are equal (ignoring multi-byte-ness) is intentional. The example you gave proves nothing, however. In fact, when that string is presented by `string-as-multibyte', ?\351 will be converted to a private space character in Unicode and therefore will have more than one byte in its representation. Thus the length in bytes of the string (as multibyte) will be 7 (or maybe more, I forget which private space naked bytes live in). Here's one way to get byte length of a string: (defun string-byte-count (s) (length (if (string-multibyte-p s) (encode-coding-string s 'utf-8) s)))