bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Bruno Haible <bruno@clisp.org>
Cc: bug-gnulib@gnu.org
Subject: Re: supporting strings > 2 GB
Date: Sat, 12 Oct 2019 20:01:54 -0700	[thread overview]
Message-ID: <749e79a7-0c0b-74d9-dbda-9a4676a931d2@cs.ucla.edu> (raw)
In-Reply-To: <15256545.f1uGFDiRv1@omega>

On 10/12/19 7:38 AM, Bruno Haible wrote:

> Has this already been discussed in the Austin Group, or on the glibc list?

Not as far as I know, though I haven't read all those mailing lists. It would be 
a good thing to do.

I'm not sold on a new type 'printf_len_t' in the standard. Can't we get by with 
using ptrdiff_t instead? That would save standard C libraries the hassle of 
specifying a new length modifier and/or macros like PRIdPRINTF and SCNdPRINTF, 
for programs that want to print or read printf_len_t values.

Gnulib may need something like printf_len_t, PRIdPRINTF etc., but I don't quite 
see why POSIX and/or the C standard would need them.

>>    3) Introduce %ln as a printf_len_t alternative to %n.

Would %ln work only for the new *l functions, or would it also work for the 
already-standard printf functions?

How about the '*' field width? There needs to be some way to say that the field 
width is of type ptrdiff_t, not int. Would '**' stand for ptrdiff_t field widths?

Perhaps it would be simpler if the new *l functions use ptrdiff_t everywhere 
that the old functions use 'int' for sizes and widths. Then we wouldn't have to 
worry about '**' vs '*', or about '%ln' versus '%n'. The Gnulib layer could 
resolve whether the functions are about int or ptrdiff_t.

I assume functions like snprintfl would take ptrdiff_t arguments instead of 
size_t arguments for buffer sizes.

Basically, replace size_t and int with ptrdiff_t everywhere we can.



  reply	other threads:[~2019-10-13  3:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-12 14:38 supporting strings > 2 GB Bruno Haible
2019-10-13  3:01 ` Paul Eggert [this message]
2019-10-13 17:38   ` Bruno Haible
2019-10-13 18:32     ` Paul Eggert
2019-10-13 19:50   ` Bruno Haible
2019-10-13 20:12     ` Paul Eggert

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

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

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

  git send-email \
    --in-reply-to=749e79a7-0c0b-74d9-dbda-9a4676a931d2@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).