[Top][All Lists]

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

Re: RFC: locale-sensitive Emacs functions

From: Paul Eggert
Subject: Re: RFC: locale-sensitive Emacs functions
Date: Tue, 28 Mar 2017 12:37:16 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

Thanks, this looks like a reasonable way to proceed. Some comments:

There is no need for any of those backslashes at line end. Also, please indent consistently.

The manual needs to be updated, and there needs to be some test cases.

+The \\=' flag is ignored for all arguments except %d.

This places too many constraints on the implementation. Instead, please say only that the behavior is defined for %d, and leave things undefined if the ' flag is used for any other conversion. We may want to add support for %'x at some point, for example.

This should document what happens when the 0 and ' flags are both used. Are grouping characters inserted before zero-padding, or after? I think it's before (as in POSIX), but you should check this.

+                 if (apos_flag && INTEGERP (args[n]))

I don't see why that "&& INTEGERP (args[n])" is needed. Please remove it.

The code does not appear to do the right thing when the space or + flags are used, or when the integer is negative. It treats the leading sign or space as if it were a digit.

The code assumes that format-digit-separator is ASCII; it might not be.

Add test cases for the above corner cases.

Adjust SPRINTF_BUFSIZE to account for the worst-case buffer size when %'d is used. I suppose it should be the maximum of its current value, and (INT_BUFSIZE_BOUND (printmax_t) + (INT_STRLEN_BOUND (printmax_t) - 2) * MAX_MULTIBYTE_LENGTH), but you should check this.

Use an O(N) rather than an O(N**2) algorithm when inserting grouping characters.

reply via email to

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