This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v7] Implement strlcpy, strlcat [BZ #178]


On 01/06/2016 02:28 AM, Paul Eggert wrote:
> Florian Weimer wrote:
>> I see the value as a post-condition, but I felt that your wording was
>> using the post-condition as a way to specify a pre-condition an
>> application has to adhere to, which I think is misleading.
> 
> Perhaps we can think of a way to reword it that is not so misleading.
> The postcondition that the output is always null-terminated, together
> with the constraint that the output fits within the size, means that the
> size is nonzero. Perhaps add "Requiring @var{size} to be nonzero
> guarantees space to null-terminate the destination."?

I think you wanted size 0 to be undefined in the documentation?  If we
do that, we can simplify the description.

(It is meaningless to discuss behavior of a function which is called
when its preconditions does not hold.  If it appears to make sense to
add something like this to a specification, it means that the
preconditions have not been described correctly.)

Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]