[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash-4.3 Official Patch 30

From: Chet Ramey
Subject: Re: Bash-4.3 Official Patch 30
Date: Tue, 07 Oct 2014 18:44:24 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

On 10/7/14, 6:31 PM, Ángel González wrote:

>>> Changing it to return 0 instead of '\0' would probably be more clear.
>>> No need to return a pointer to a static empty string.
>> It depends on how you want the function to work.  It is nice to
>> differentiate between the cases where there is no shell input line
>> at all, where the index is just wrong, and the actual current input
>> pointer.  A "" indicates the second case better than a 0, though it's
>> not perfect.
>> Chet
> Note it **is** returning NULL, not "" as it seemed implied by earlier
> messages. Only verified gcc (4.9.1) behavior, but that's also what I
> expected from the C code:  '\0' (char) promoted to 0 (int), then to 
> NULL (char*)

Yes, that's right.  The question is whether that case of the index out
of bounds should continue to return NULL, but in a clearer way, or
return "" to differentiate it from the case where shell_input_line is

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]