On 30 July 2012 21:51, Martin Sucha <[email protected]> wrote:
> On Monday 30 July 2012 21:04:59 Jiří Zárevúcky wrote:
>> On 29 July 2012 21:15, Martin Sucha <[email protected]> wrote:
>> > Ok, I'll fix the documentation to reflect current implementation of
>> > str_cmp and str_lcmp.
>>
>> I don't think the new documentation is correct either.
>>
>> * A string is smaller than another string iff it is shorter or
>> * has a character with lower value at the first position where
>> * the strings differ.
>>
>> The way it's written it implies that a shorter string is always less
>> than a longer string.
>> That is not true for the current implementation, which uses
>> lexicographical ordering.
> Yes, you are right, this paragraph is misleading. I should have read it once
> more before commiting. Thanks for review!
>
> What about this version:
> A string S1 is smaller than another string S2 if it has a character with lower
> value at the first character position where the strings differ or in a special
> case when S1 is a proper prefix of S2.
>

Looks good.

Here is another formulation that doesn't treat prefixes as a special case:
A string S1 is less than another string S2 if it has a character with
lower value at the first character position where the strings differ.
If the strings differ in length, the shorter one is treated as if
padded by zero characters.

Use whichever seems better to you.

_______________________________________________
HelenOS-devel mailing list
[email protected]
http://lists.modry.cz/cgi-bin/listinfo/helenos-devel

Reply via email to