[distcc] Re: yet another C-supporting cmdline scanner
Markus Werle
numerical.simulation at web.de
Thu Jul 10 12:49:18 GMT 2003
Martin Pool wrote:
> On 10 Jul 2003, Markus Werle <numerical.simulation at web.de> wrote:
> > Hi!
> >
> > This one also looks promising if you want to stay with C
> >
> > http://argtable.sourceforge.net/doc/html/Tutorial.html
>
> Hi,
>
> I realize there are argument-parsing libraries in C; this looks like a
> decent one and I appreciate you bringing it to my attention.
>
> However from my point of view the heart of the problem here is not
> parsing the arguments.
OK.
> It is whether there is a table representation
> of the way arguments should be interpreted that would be any simpler
> than writing it out in C.
Well I always prefer the in-language solution.
This is why I think the approach used in argtable would be OK for me.
> (I think what we're both trying to do is
> make the code cleaner, and make it easy to support other compilers --
> is that right?)
The latter one for me.
> There are some other problems with using most argv-handling libraries:
> most of them don't have good facilities for manipulating and copying
> argv[] arrays,
I propose to parse the cmdline and store its components
(known flags, compiler flags) in an internal, pointable data structure
and provide a pointer to it for every function that is called.
foo(somearg*);
becomes
foo(somearg*, run_time_args* rta);
Did I understand your problem/question?
> and many of them flag errors when unknown arguments are
> seen (rather than passing them through).
This may become a problem, but I think it is resolvable.
> In addition gcc argument handling is a bit idiosyncratic: e.g. the mix
> of double-dash and single-dash arguments, complex relationships
> between arguments, etc.
Probably I have to provide a solution to this in C++.
Just because it is simple in that language.
I just felt like it would be better for distcc to keep it in C,
because once You switch to C++ you
a) loose a lot of now supported platforms
b) are in need of a complete redesign:
I saw many typical C idioms in the code, which do not fit
into the C++ way of doing it.
OTOH if you think about rewriting it in C++ I will certainly
give my 2 cent and provide the parsing utility.
Markus
More information about the distcc
mailing list