Re: [PATCH 1/6] Introduce sorted-array binary-search function.
- From
Erik Faye-Lund <kusmabite@gmail.com>
- Date
- Dec 30, 2010, 01:06 UTC
- Message-ID
- <AANLkTimkemRW1H7XvwbECWUHHWVpGnvKukn06DiQO9Ce@mail.gmail.com>
- In-Reply-To
- <20101230004027.GB6639@home.lan>
On Thu, Dec 30, 2010 at 1:40 AM, Yann Dirson <ydirson@free.fr> wrote:
Show 6 quoted lines
> On Fri, Dec 10, 2010 at 02:29:09PM -0800, Junio C Hamano wrote: >> In addition, these macros in this patch are almost unreadable, but that >> probably is mostly a fault of C's macro, not yours. > > Yes. When writing those I sorely missed the readability of C++ > templates - yuck :)
Unfortunately, it's something that ends up subtracting from the value of the change; a couple of duplicate functions is often easier to maintain than nasty macros.
Perhaps the pre-processor is not the right tool for the job? Some times a generator (a perl script?) can be more readable. Unfortunately, some times it's not :P