Achilleas Margaritis <axil...@gmail.com> writes:

> I have a idea for automatic generation of headers in a c++ program.
> Having to maintain headers is a very time consuming task, and I think
> we will all benefit from such a thing. The idea is the following:
>
> Each time the compiler finds the pragma
>
> #pragma autoinclude("foo.hpp")
>
> it does the following:
>
> 1) searches the include path for the header foo.hpp.
>
> 2) if the header does not exist, then the compiler searches for the
> file 'foo.cpp'
>
> 3) if the file 'foo.cpp' is found, then the header 'foo.hpp' is
> generated automatically from the the .cpp file.
>
> 4) if the header exists, then the compiler compares the file dates of
> the header and the implementation files. If the header is older than
> the implementation file, then a new header is generated from the
> implementation file.

It's an interesting idea.  I think you are trying to create a module
system for C++.  You may want to take a look at
www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2073.pdf .  I think an
approach along those lines might make more sense than inventing header
files based on C++ files, and then modifying the language to make those
invented header files work correctly.

Ian

Reply via email to