Re: Why auto generate a c header file?



On Oct 28, 9:22 am, "Phlip" <phlip...@xxxxxxxxx> wrote:
Chad wrote:
1)Why autogenerate the header file?

Because the source code that developers actually write should be DRY - it
should obey the rule "Don't Repeat Yourself".

The tables you provided repeat themselves all over the place. So we should
not maintain the tables by editing these files directly. We should edit
another source file, and use it to generate these files. The goal is only
one edit should correctly update everything in those tables.

The main problem is C has primitive support for maps of data, correlating
constants with program identifiers and strings.

In the programs documentation, the
author says that it's easier to add options and commands by using auto
generating the header file. I don't see how. Wouldn't it just be
easier to edit the header file vs going through the effort of making a
program to auto generate a header file?

If you edit the raw C files, you could easily make a mistake. You could
update one data element, but not the elements that repeat its information.
This issue creates more problems, because you might edit that file less
often than you should.

2)In makeopt.c, the data looks like it is being written to stdout.
However, the data is appearing in opt.h. How can the author do this
without redirecting the file handle?

With a Makefile and a redirector inside it, right?

--
Phlip


Okay, I'll look for some kind of redirector inside the Makefile.

.



Relevant Pages

  • Re: Why auto generate a c header file?
    ... Because the source code that developers actually write should be DRY - it ... The tables you provided repeat themselves all over the place. ... one edit should correctly update everything in those tables. ... generating the header file. ...
    (comp.programming)
  • Re: EMenu, margins disappearing
    ... Re your edit menu - http://word.mvps.org/FAQs/AppErrors/MissngMenusEtc.htm ... Word MVP web site www.mvps.org/word ... I'm so used to using it to repeat formatting. ...
    (microsoft.public.word.customization.menustoolbars)
  • Re: Question regarding the standard library?
    ... Is it allowed to edit the source code of the standard library? ... Python ships with the library sources, and you can of course edit them ... the standard library, so I monkeypatched SGMLParser: ...
    (comp.lang.python)
  • Re: Content Editor Web Part Javascript error with more than 2 on a
    ... Were you able to resolve this ... My issue was resolved by clearing the source code ... within the Content Editor Web Part Source Editor text box. ... Edit the content of the content editor web part by selecting the ...
    (microsoft.public.sharepoint.portalserver)
  • Re: Content Editor Web Part Javascript error with more than 2 on a
    ... Were you able to resolve this ... My issue was resolved by clearing the source code ... within the Content Editor Web Part Source Editor text box. ... Edit the content of the content editor web part by selecting the ...
    (microsoft.public.sharepoint.portalserver)