git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pierre Habouzit <madcoder@madism.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>, Pierre Habouzit <madcoder@debian.org>,
	git@vger.kernel.org
Subject: Re: [PATCH 2/3] refactor: use bitsizeof() instead of 8 * sizeof()
Date: Thu, 23 Jul 2009 08:22:50 +0200	[thread overview]
Message-ID: <20090723062250.GH4750@laphroaig.corp> (raw)
In-Reply-To: <7v3a8o6l3v.fsf@alter.siamese.dyndns.org>

On Wed, Jul 22, 2009 at 10:09:56PM -0700, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes:
> 
> > On Wed, Jul 22, 2009 at 11:34:34PM +0200, Pierre Habouzit wrote:
> >
> >>  #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
> >> +#define bitsizeof(x)  (CHAR_BIT * sizeof(x))
> >
> > Isn't our style to use all-caps for macros? I.e., BITSIZEOF?
> 
> Perhaps but I'd say similarity between sizeof() and bitsizeof() calls for
> consistency in the lowercase in this particular case.

Yes, I usually have a few other macros that I use in code I write,
namely bitsizeof, fieldsizeof, fieldtypeof and a couple other, and all
are lowercased because:
  - it's a safe macro (doesn't multi-evaluate its arguments), hence the
    user doesn't really need to know it's a macro ;
  - similarity with sizeof().

-- 
Intersec <http://www.intersec.com>
Pierre Habouzit <pierre.habouzit@intersec.com>
Tél : +33 (0)1 5570 3346
Mob : +33 (0)6 1636 8131
Fax : +33 (0)1 5570 3332
37 Rue Pierre Lhomme
92400 Courbevoie

  parent reply	other threads:[~2009-07-23  6:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-22 21:34 janitoring Pierre Habouzit
2009-07-22 21:34 ` [PATCH 1/3] janitor: use NULL and not 0 for pointers Pierre Habouzit
2009-07-22 21:34   ` [PATCH 2/3] refactor: use bitsizeof() instead of 8 * sizeof() Pierre Habouzit
2009-07-22 21:34     ` [PATCH 3/3] janitor: add DIV_ROUND_UP and use it Pierre Habouzit
2009-07-23  5:07     ` [PATCH 2/3] refactor: use bitsizeof() instead of 8 * sizeof() Jeff King
2009-07-23  5:09       ` Junio C Hamano
2009-07-23  5:11         ` Jeff King
2009-07-23  5:15           ` Junio C Hamano
2009-07-23  6:22         ` Pierre Habouzit [this message]
2009-07-22 22:00 ` janitoring Junio C Hamano
2009-07-22 22:02   ` janitoring Pierre Habouzit
2009-07-22 22:19     ` janitoring Junio C Hamano
2009-07-22 22:29   ` janitoring Johannes Schindelin
2009-07-23  7:27 ` janitoring Johannes Sixt

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=20090723062250.GH4750@laphroaig.corp \
    --to=madcoder@madism.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=madcoder@debian.org \
    --cc=peff@peff.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).