Re: [RFC] Update on builtin-commit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2007-07-02 at 17:11 +0100, Johannes Schindelin wrote:
> just a quick comment on the option parser:
> 
> On most platforms, sizeof(void*)>=sizeof(int). But I would not rely on 
> that. Rather (also because it is prettier), I'd use "union".

In the OPTION_INTEGER case, the 'value' void pointer points to an
integer global that's set to the value passed.  In the OPTION_NONE, it
also points to an integer, which is set to 1 if the option is seen.  So
I'm relying on sizeof(void*) == sizeof(int*), but I'm not storing ints
in pointers.

> Besides, your option parser loses order information, correct? IOW, 
> something like "--color --no-color --color" would confuse it.

Yes, I don't record the order of options, but in the builtin-commit
case, I don't think there are any options where that makes a difference?
In cases where order is important or we have an option that negates the
effect of another option (your --no-color example), we could either 1)
extend the option struct with a 'disable' name that flips the value back
to 0 or 2) instead of just setting it to 1, record the index of the
options passed and compare the indexes of conflicting options to see
which one was passed last.

Kristian


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux