This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v1 02/36] Guile extension language: doc additions
- From: Doug Evans <xdje42 at gmail dot com>
- To: Eli Zaretskii <eliz at gnu dot org>
- Cc: Ludovic Courtès <ludo at gnu dot org>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Sun, 19 Jan 2014 13:18:56 -0800
- Subject: Re: [PATCH v1 02/36] Guile extension language: doc additions
- Authentication-results: sourceware.org; auth=none
- References: <52b9da59 dot 64ab440a dot 0b0b dot 7e1c at mx dot google dot com> <83ha9w68av dot fsf at gnu dot org> <87sit4kb1t dot fsf at gnu dot org> <83eh4ow78t dot fsf at gnu dot org> <87k3egez8e dot fsf at gnu dot org> <CAP9bCMTR8Dv7ejLWs0yqeFLja8-fck08kvHHWiJdS09WAG5nbw at mail dot gmail dot com> <87mwitovvh dot fsf at gnu dot org> <CAP9bCMS_GndeCGpG7cPkbb9ptL9yO=CKJWRhsA6Obfxb1wCSJg at mail dot gmail dot com> <83wqhvj4bw dot fsf at gnu dot org> <CAP9bCMR4Di_mCoEPZnkjSS87Cf_RH8TDL7p84Ykdfkqn1eyj6A at mail dot gmail dot com> <83txczj2o2 dot fsf at gnu dot org> <CAP9bCMSKyvHrhmEnvrde12L_LiCzL8JU5RqPzHEBrRWc4_Og_A at mail dot gmail dot com> <83sisjj105 dot fsf at gnu dot org>
On Sun, Jan 19, 2014 at 10:10 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Sun, 19 Jan 2014 09:53:21 -0800
>> From: Doug Evans <xdje42@gmail.com>
>> Cc: Ludovic Courtès <ludo@gnu.org>,
>> "gdb-patches@sourceware.org" <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 length
>> > 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 how 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}.