all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Gdobbins <gdobbins@protonmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: RFC: locale-sensitive Emacs functions
Date: Tue, 28 Mar 2017 12:37:16 -0700	[thread overview]
Message-ID: <ac7a7cb9-1276-157b-6d13-e6b9ee879951@cs.ucla.edu> (raw)
In-Reply-To: <DUkEbNKVK1611uZJHQLMjX4QQRzby0Sg5dlDxNIC9xN1Xp_3ujOAi5g4L6azht5tKDB1qpql6BokG-QJoixg_VYpVFXX3HTa6fwTV3orFeI=@protonmail.com>

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.



      parent reply	other threads:[~2017-03-28 19:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-28  3:06 RFC: locale-sensitive Emacs functions Ted Zlatanov
2017-03-28  4:10 ` Gdobbins
2017-03-28  4:37   ` Paul Eggert
2017-03-28 11:59     ` Gdobbins
2017-03-28 12:45       ` Ted Zlatanov
2017-03-30 18:27         ` Ted Zlatanov
2017-03-31  4:27           ` Gdobbins
2017-03-31 17:59             ` Davis Herring
2017-03-28 19:37       ` Paul Eggert [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ac7a7cb9-1276-157b-6d13-e6b9ee879951@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=gdobbins@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.