help / color / mirror / Atom feed
From: Ingo Schwarze <>
To: Joerg Sonnenberger <>
Subject: Re: mdocml: The st_size member of struct stat is off_t, which is signed, all
Date: Wed, 11 Mar 2015 02:10:32 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

[ Moving this to tech@ ]

Hi Joerg,

Joerg Sonnenberger wrote on Tue, Mar 10, 2015 at 10:47:38PM +0100:
> On Tue, Mar 10, 2015 at 09:18:22AM -0500, wrote:

>> Log Message:
>> -----------
>> The st_size member of struct stat is off_t, which is signed,
>> all required by POSIX.  So don't compare it against against 
>> an unsigned constant.

> Well, the change truncates the value.

How so?  The actual width of size_t will hardly be narrower
than the width of off_t on any sane platform, or am i mistaken?

The values of off_t are positive, so the range of size_t
completely covers the range of off_t that can occur.

> Wouldn't it make more sense to use just use 0x7fffffff
> as constant instead? I think POSIX ensures that int is 32bit.

That seems completely equivalent to me, but maybe i'm missing

Arguably, a comparison to 0x7fffffff is easier to understand
than a cast plus a comparison to (1 << 31), though - hmm...

 To unsubscribe send an email to

       reply	other threads:[~2015-03-11  1:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
     [not found] ` <>
2015-03-11  1:10   ` Ingo Schwarze [this message]
2015-03-11  1:18     ` Joerg Sonnenberger
2015-03-11 13:30       ` Ingo Schwarze

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:

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

  git send-email \ \ \ \ \

* 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 NNTP newsgroup(s).