git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Junio C Hamano <gitster@pobox.com>,
	Olga Telezhnaya <olyatelezhnaya@gmail.com>,
	git@vger.kernel.org
Subject: Re: [RFC PATCH 1/5] ref-filter: add objectsize:disk option
Date: Mon, 12 Nov 2018 08:12:47 -0500	[thread overview]
Message-ID: <20181112131247.GL3956@sigill.intra.peff.net> (raw)
In-Reply-To: <nycvar.QRO.7.76.6.1811121300520.39@tvgsbejvaqbjf.bet>

On Mon, Nov 12, 2018 at 01:03:25PM +0100, Johannes Schindelin wrote:

> > oi.disk_size is off_t; do we know "long long" 
> > 
> >    (1) is available widely enough (I think it is from c99)?
> > 
> >    (2) is sufficiently wide so that we can safely cast off_t to?
> > 
> >    (3) will stay to be sufficiently wide as machines get larger
> >        together with standard types like off_t in the future?
> > 
> > I'd rather use intmax_t (as off_t is a signed integral type) so that
> > we do not have to worry about these questions in the first place.
> 
> You mean something like
> 
> 			v->s = xstrfmt("%"PRIdMAX, (intmax_t)oi->disk_size);

I think elsewhere we simply use PRIuMAX for printing large sizes via
off_t; we know this value isn't going to be negative.

I'm not opposed to PRIdMAX, which _is_ more accurate, but...

> P.S.: I wondered whether we have precedent for PRIdMAX, as we used to use
> only PRIuMAX, but yes: JeffH's json-writer uses PRIdMAX.

That's pretty recent. I won't be surprised if we have to do some
preprocessor trickery to handle that at some point. We have a PRIuMAX
fallback already. That comes from c4001d92be (Use off_t when we really
mean a file offset., 2007-03-06), but it's not clear to me if that was
motivated by a real platform or an over-abundance of caution.

I'm OK with just using PRIdMAX as appropriate for now. It will serve as
a weather-balloon, and we can #define our way out of it later if need
be.

-Peff

  reply	other threads:[~2018-11-12 13:12 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-09  7:37 [RFC PATCH 0/5] ref-filter: add new formatting options Оля Тележная
2018-11-09  7:44 ` [RFC PATCH 1/5] ref-filter: add objectsize:disk option Olga Telezhnaya
2018-11-09  7:44   ` [RFC PATCH 2/5] ref-filter: add tests for objectsize:disk Olga Telezhnaya
2018-11-09  7:44   ` [RFC PATCH 3/5] ref-filter: add deltabase option Olga Telezhnaya
2018-11-09  7:44   ` [RFC PATCH 4/5] ref-filter: add tests for deltabase Olga Telezhnaya
2018-11-09  7:44   ` [RFC PATCH 5/5] ref-filter: add docs for new options Olga Telezhnaya
2018-11-12  5:24     ` Junio C Hamano
2018-11-12  5:03   ` [RFC PATCH 1/5] ref-filter: add objectsize:disk option Junio C Hamano
2018-11-12 12:03     ` Johannes Schindelin
2018-11-12 13:12       ` Jeff King [this message]
2018-11-13  1:52         ` Junio C Hamano
2018-11-20  9:17           ` Оля Тележная
2018-11-21  0:27             ` Junio C Hamano
2018-11-22 11:33               ` Johannes Schindelin
2018-11-24  1:48                 ` Junio C Hamano
2018-11-12 13:05     ` Jeff King
2018-12-24 13:16 ` [PATCH v2 0/5] ref-filter: add new formatting options Оля Тележная
2018-12-24 13:24   ` [PATCH v2 1/6] ref-filter: add objectsize:disk option Olga Telezhnaya
2018-12-24 13:24     ` [PATCH v2 5/6] ref-filter: add tests for deltabase Olga Telezhnaya
2018-12-24 13:24     ` [PATCH v2 2/6] ref-filter: add check for negative file size Olga Telezhnaya
2018-12-24 13:24     ` [PATCH v2 3/6] ref-filter: add tests for objectsize:disk Olga Telezhnaya
2018-12-24 13:24     ` [PATCH v2 6/6] ref-filter: add docs for new options Olga Telezhnaya
2018-12-24 13:24     ` [PATCH v2 4/6] ref-filter: add deltabase option Olga Telezhnaya
2018-12-26 20:44     ` [PATCH v2 1/6] ref-filter: add objectsize:disk option Junio C Hamano
2019-01-10  6:25   ` [PATCH v2 0/5] ref-filter: add new formatting options Оля Тележная
2019-01-10  6:32     ` [PATCH v3 1/6] ref-filter: add objectsize:disk option Olga Telezhnaya
2019-01-10  6:32       ` [PATCH v3 3/6] ref-filter: add tests for objectsize:disk Olga Telezhnaya
2019-01-10  6:32       ` [PATCH v3 5/6] ref-filter: add tests for deltabase Olga Telezhnaya
2019-01-10  6:32       ` [PATCH v3 4/6] ref-filter: add deltabase option Olga Telezhnaya
2019-01-10  6:32       ` [PATCH v3 2/6] ref-filter: add check for negative file size Olga Telezhnaya
2019-01-10  6:32       ` [PATCH v3 6/6] ref-filter: add docs for new options Olga Telezhnaya
2019-01-10 18:17     ` [PATCH v2 0/5] ref-filter: add new formatting options Junio C Hamano

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: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20181112131247.GL3956@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=olyatelezhnaya@gmail.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 public inbox

	https://80x24.org/mirrors/git.git

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