From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: internal data structure Date: Sat, 20 May 2017 16:33:02 +0200 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1495290827 6867 195.159.176.226 (20 May 2017 14:33:47 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 20 May 2017 14:33:47 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat May 20 16:33:42 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dC5Rt-0001fj-LO for geh-help-gnu-emacs@m.gmane.org; Sat, 20 May 2017 16:33:41 +0200 Original-Received: from localhost ([::1]:34452 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dC5Rz-000447-7l for geh-help-gnu-emacs@m.gmane.org; Sat, 20 May 2017 10:33:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dC5RT-000442-0i for help-gnu-emacs@gnu.org; Sat, 20 May 2017 10:33:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dC5RP-0001vm-UG for help-gnu-emacs@gnu.org; Sat, 20 May 2017 10:33:15 -0400 Original-Received: from [195.159.176.226] (port=51441 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dC5RP-0001vJ-Mp for help-gnu-emacs@gnu.org; Sat, 20 May 2017 10:33:11 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dC5RH-0000v7-8i for help-gnu-emacs@gnu.org; Sat, 20 May 2017 16:33:03 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 40 Original-X-Complaints-To: usenet@blaine.gmane.org Mail-Copies-To: never Cancel-Lock: sha1:bJdJruuYZDRU3EhnCI0WSYC2qfo= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:113086 Archived-At: Alexander Doe wrote: > which data structure is used by GNU/Emacs for > storing and editing text strings on > low-level? List, balanced tree, gap buffer, > something else? > > Which language is used for programming this? > C or ELisp? Emacs is Lisp on top of C. The strings in Lisp are data objects that are string-typed. This contrary to a language like C where it is the *variable*, non the data object, that is associated with a type. That said, there isn't a string type in C. In C what you do is either you have an array of chars, or you have a pointer to a char and then continue in memory a certain number of bytes, which is the length of the text string, as 1 char is stored as 1 byte. In practice, the array and pointer methods in C amount to virtually the same. By the way, "char" is pronounced "kar"! In Lisp, or Elisp at least, because everything is lists, it is tempting to think of a string as a list of chars, just like the C array. But technically, this is not the case: (stringp "Sail Ho!") ; t (listp "True sailing is dead.") ; nil -- underground experts united http://user.it.uu.se/~embe8573