bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: bug-gnulib@gnu.org
Subject: Re: supporting strings > 2 GB
Date: Sun, 13 Oct 2019 21:50:19 +0200	[thread overview]
Message-ID: <1779544.eJvvWEHBEu@omega> (raw)
In-Reply-To: <749e79a7-0c0b-74d9-dbda-9a4676a931d2@cs.ucla.edu>

Hi Paul,

Probably I didn't explain it well. Let me try again.

> 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.

The code will consist of two layers:

1) A layer that defines functions.
   Example:
     ptrdiff_t lprintf (const char *format, ...)
     _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2);

2) A layer that may redefine functions and types through aliases.
   Example:
     #if _PRINTF_LARGE
       #undef printf
       #define printf lprintf
       #define printf_len_t ptrdiff_t
     #else
       #define printf_len_t int
     #endif

This is similar to how the large file support was implemented
in two layers:

1) A function
     off64_t lseek64(int fd, off64_t offset, int whence);

2) A layer that redefines functions and types:

     #if _FILE_OFFSET_BITS == 64
       #define lseek lseek64
       #define off_t off64_t
     #endif

The C or POSIX standards deal only with layer 1). However, layer 2) is
essential for programs, to make the use of the new APIs easy.

Bruno



  parent reply	other threads:[~2019-10-13 19:50 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
2019-10-13 17:38   ` Bruno Haible
2019-10-13 18:32     ` Paul Eggert
2019-10-13 19:50   ` Bruno Haible [this message]
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=1779544.eJvvWEHBEu@omega \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=eggert@cs.ucla.edu \
    /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).