git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: David Soria Parra <sn_@gmx.net>
Cc: git@vger.kernel.org, David Soria Parra <dsp@php.net>
Subject: Re: [PATCH 1/2] Improvate portability: Display pid_t's always as long
Date: Wed, 27 Aug 2008 12:03:46 -0700	[thread overview]
Message-ID: <7vsksqp9f1.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <1219858743-4476-2-git-send-email-sn_@gmx.net> (David Soria Parra's message of "Wed, 27 Aug 2008 19:39:02 +0200")

David Soria Parra <sn_@gmx.net> writes:

> Some systems (like e.g. OpenSolaris) define pid_t as long,
> therefore all our sprintf that use %i cause a compiler warning
> beacuse if the implicit long->int cast. So to make sure that
> we fit the limits we display pids as longs and cast them explicitly.

This patch just makes one wonder what needs to happen when the next random
platform has pid_t as long long or int32_t or whatever signed integral
type that was picked arbitrarily by the platform.

I think these *printf()s are mostly for informational purposes and if you
favor minimum change, you might be better off casting it to "int" without
changing the format specifiers.

On the other hand, if you are shooting for maximum compatibility perhaps
you may want to cast it to "intmax_t" and format as such.

Casting to "long" does not make much sense from either perspective, does
it?

  parent reply	other threads:[~2008-08-27 19:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-27 17:39 [PATCH 0/2] Improve portability for OpenSolaris David Soria Parra
2008-08-27 17:39 ` [PATCH 1/2] Improvate portability: Display pid_t's always as long David Soria Parra
2008-08-27 17:39   ` [PATCH 2/2] Improve portability: Avoid SS constant as it is already defined David Soria Parra
2008-08-27 18:56     ` Junio C Hamano
2008-08-27 19:17       ` Junio C Hamano
2008-08-28  0:34         ` David Soria Parra
2008-08-27 19:03   ` Junio C Hamano [this message]
2008-08-30 20:40     ` [PATCH 1/2] Improvate portability: Display pid_t's always as long David Soria Parra
2008-08-31  7:15       ` 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

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

  git send-email \
    --in-reply-to=7vsksqp9f1.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=dsp@php.net \
    --cc=git@vger.kernel.org \
    --cc=sn_@gmx.net \
    /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 NNTP newsgroup(s).