Nick Wellnhofer wrote on 3/26/13 6:23 AM:

> My current implementation is somewhat ad-hoc and I'm not really happy with the
> result. I think it could be cleaned up by introducing a separate "class" for
> compiler flags (and linker flags). It could be used something like that:
> 
>     chaz_CFlags *flags = chaz_CFlags_new();
>     chaz_CFlags_append(flags, "--some-option");
>     chaz_CFlags_set_feature_abc(flags, arg1);
>     chaz_CFlags_set_feature_xyz(flags, arg2);
>     const char *flag_string = chaz_CFlags_get_string(flags);
> 
> Then the chaz_CC struct would have the following fields with corresponding
> accessors:
> 
>     chaz_CFlags *extra_cflags;
>     chaz_CFlags *temp_cflags;
> 
> Using temporary flags would work like this:
> 
>     chaz_CFlags *temp_flags = chaz_CC_get_temp_cflags();
>     chaz_CFlags_append(temp_flags, "--option");
>     chaz_CC_test_compile(...);
>     chaz_CFlags_clear(temp_flags);
> 
> What do you think?

+1


-- 
Peter Karman  .  http://peknet.com/  .  [email protected]

Reply via email to