gittup/tup — comment on commit 44ee56fdeba9034e9c2fc81e8ad0d62bec9fc51a
File: src/tup/option.c line 31
By anatol:

Hi

On Thu, Oct 27, 2011 at 5:34 PM, gittup <
reply@reply.github.com>wrote:

> On Thu, Oct 27, 2011 at 5:01 PM, Anatol
>
> wrote:
> > BTW Does it make more sense to use just a real type-safe structures for
> option similar to what described here
> http://blog.brush.co.nz/2009/08/xmacros/
> >
> > So option can be generated like
> >
> > CFG(updater, num_jobs, int, 1);
> >
> > And later anyone in the code uses it as options->updater_num_jobs (int
> field).
> >
> > The type can be any e.g. char*, for display.color enum can be used.
> >
> > I can try to do this refactoring.
>
> I'm not sure I see the point - what repetition would this avoid? In
> general I like to avoid creating macros like this since it tends to
> make grepping for things more difficult.
>

Sorry, the link I gave you a little bit misleading.

What I suggested is to use type-safe options structure and avoid storing
options as string-to-string map

struct options {
int updater_num_jobs;
bool updater_keep_going;
int display_color;
...
}

This CFG macros just avoids repeating field names/types everywhere
(structure definition, default values, parsing). But if you think that
without macros code will be cleaner - then I am ok.