[PATCH v1 02/36] Guile extension language: doc additions

Doug Evans xdje42@gmail.com
Sun Jan 19 17:53:00 GMT 2014


On Sun, Jan 19, 2014 at 9:34 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Sun, 19 Jan 2014 09:19:45 -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}.  The string is assumed to be terminated
>> by a zero of the appropriate width.  However if the optional length
>> argument is given, the string will be converted to that given length,
>> and will include any embedded zeros that the string may contain.
>
> The only problem with this text is that it seems to cover _only_
> C-like languages.  It says nothing about the other languages.
>
> How about this:
>
>   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.

There's a functionality that GDB provides to the extension language:
zero-terminated or provide your own length.  That's all Guile (or Python)
can provide because for now that's all GDB let's them.

Please can I keep the current text?
We can certainly revise it later.



More information about the Gdb-patches mailing list