From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25692 invoked by alias); 19 Jan 2014 21:19:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 25683 invoked by uid 89); 19 Jan 2014 21:19:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f169.google.com Received: from mail-wi0-f169.google.com (HELO mail-wi0-f169.google.com) (209.85.212.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 19 Jan 2014 21:18:59 +0000 Received: by mail-wi0-f169.google.com with SMTP id e4so3779940wiv.2 for ; Sun, 19 Jan 2014 13:18:56 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.181.13.40 with SMTP id ev8mr6401637wid.16.1390166336167; Sun, 19 Jan 2014 13:18:56 -0800 (PST) Received: by 10.194.17.104 with HTTP; Sun, 19 Jan 2014 13:18:56 -0800 (PST) In-Reply-To: <83sisjj105.fsf@gnu.org> References: <52b9da59.64ab440a.0b0b.7e1c@mx.google.com> <83ha9w68av.fsf@gnu.org> <87sit4kb1t.fsf@gnu.org> <83eh4ow78t.fsf@gnu.org> <87k3egez8e.fsf@gnu.org> <87mwitovvh.fsf@gnu.org> <83wqhvj4bw.fsf@gnu.org> <83txczj2o2.fsf@gnu.org> <83sisjj105.fsf@gnu.org> Date: Sun, 19 Jan 2014 21:19:00 -0000 Message-ID: Subject: Re: [PATCH v1 02/36] Guile extension language: doc additions From: Doug Evans To: Eli Zaretskii Cc: =?ISO-8859-1?Q?Ludovic_Court=E8s?= , "gdb-patches@sourceware.org" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-01/txt/msg00725.txt.bz2 On Sun, Jan 19, 2014 at 10:10 AM, Eli Zaretskii wrote: >> Date: Sun, 19 Jan 2014 09:53:21 -0800 >> From: Doug Evans >> Cc: Ludovic Court=E8s , >> "gdb-patches@sourceware.org" >> >> > For C-like languages, a value is a string if it is a pointer to or an >> > array of characters or ints of type @code{wchar_t}, @code{char16_t}, >> > or @code{char32_t}. For other languages ... [say here how string >> > values are distinguished in other languages]. If the string is >> > terminated by a zero of the appropriate width, it will be converted = up >> > to that zero. For strings that are not zero-terminated (which >> > includes strings in non C-like languages), you must specify the leng= th >> > for conversion. >> >> Even in C-like languages the user may wish to specify a length. >> >> E.g., C++ strings have a length, but it's up to the library to specify h= ow it's >> recorded. Plus C++ programs can have multiple string implementations >> (not just std::string). Not always ideal, but an app may have a specific >> performance issue for a specific part of it and thus provides its own >> string implementation for that part. Thus in this (important) case there >> is no text I can provide here to answer the question you are asking. >> >> Plus there's a maintenance issue of describing how each language >> defines a string. We don't want to have to update this part for each >> new language. > > Fair enough. How about the following variant, which is entirely > agnostic to the language? > > Values are interpreted as strings according to the rules of the > current language. If the optional length argument is given, the > string will be converted to that length. Otherwise, for languages > where the string is zero-terminated, the entire string will be > converted. > > If you want to say something about C-like languages, we can have a > "for example" sentence after the 1st one. Something like > > For example, in C-like languages, a value is a string if it is a > pointer to, or an array of, characters or ints of type ... > >> Please can I keep the current text? > > If you think it is better than what I suggested above. I tweaked it a bit because I wanted to make clear specifying the length will include any embedded zeroes. Values are interpreted as strings according to the rules of the current language. If the optional length argument is given, the string will be converted to that length, and will include any embedded zeroes that the string may contain. Otherwise, for languages where the string is zero-terminated, the entire string will be converted. For example, in C-like languages, a value is a string if it is a pointer to or an array of characters or ints of type @code{wchar_t}, @code{char16_t= }, or @code{char32_t}.