[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git
Subject:    Re: [RFC PATCH 0/2] Allow detached forms (--option arg) for git
From:       Pierre Habouzit <madcoder () debian ! org>
Date:       2010-07-28 13:06:11
Message-ID: 20100728130610.GG6895 () madism ! org
[Download RAW message or body]

On Tue, Jul 27, 2010 at 08:10:35AM -0700, Jakub Narebski wrote:
> Pierre Habouzit <madcoder@debian.org> writes:
> 
> > On Mon, Jul 26, 2010 at 02:31:09PM -0500, Jonathan Nieder wrote:
> > > Hi Matthieu,
> > > 
> > > Matthieu Moy wrote:
> > > 
> > > >                    is there any reason why "git log" hasn't been
> > > > migrated to parse-option? Or is it only that nobody did it yet?
> > > 
> > > Please go ahead. :)
> > 
> > I started it in the past, but never went around to actually do it.
> > 
> > I started to get rid of most of the bitfields to use explicit or-ed
> > fields, but stopped at that, I don't even remember if those patches got
> > merged or not.
> 
> Why did you feel this change was needed / necessary?  Was it
> limitation of parseopt?  Or perhaps it was for portability reasons?
> Or was it just the matter of code elegance?

you cannot take the address of a bit portably in C, so you can't let
parseopt set/clear bits through bitfields (as in unsigned field : 1 in a
struct in C I mean).

So to use parseopt OPTION_BIT feature, you have to convert them to C
flags as in "unsigned flags" and explicit masks defines/enums.

IOW:

    struct foo {
       unsigned bar : 1,
		...
		baz : 1;
    };

Must be converted into:

    struct foo {
    #define FOO_FLAG_BAR (1U <<  1)
    ...
    #define FOO_FLAG_BAZ (1U << 18)
      unsigned flags;
    }

so that you can use parseopt.  that's what I meant.


This was done for the rev-list parsing stuff e.g.
-- 
 ·O ·  Pierre Habouzit
 · ·O                                                madcoder@debian.org
OOO                                                http://www.madism.org
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic