Autogenerate header files
Aug. 3rd, 2006 01:43 amHaving updated a header file checked in out of sync with the source file, one of a large number of stupid question "how editing environments should be" musings comes back to me.
Why aren't C header files generated automatically from the source file? Having the function declaration in two different places seems against the grain, and simple preprocessing could strip out everything except non-static functions.
Is it slower? Barely, surely, especially if your script can tell when the header doesn't need to change. Does someone else needs to link with them? So provide them. Should the comments in the header file should be aimed at people using the function, whilst those in the source for people maintaining it? Maybe, but you'd think the instructions should be there, else they'd never be updated, and if so you could easily have a keyword indicating which comments to move to the header if any.
Why aren't C header files generated automatically from the source file? Having the function declaration in two different places seems against the grain, and simple preprocessing could strip out everything except non-static functions.
Is it slower? Barely, surely, especially if your script can tell when the header doesn't need to change. Does someone else needs to link with them? So provide them. Should the comments in the header file should be aimed at people using the function, whilst those in the source for people maintaining it? Maybe, but you'd think the instructions should be there, else they'd never be updated, and if so you could easily have a keyword indicating which comments to move to the header if any.