>> Why not? doesn't GCC contain all that is required for that parsing to 
>> succeed?
>
> GCC has bugs and doesn't parse everything 100% correctly, given the
> complexity of the language.

Oh, ok then. But I think consistence is more important than
correctness in this case: the result header file should be as if it
was manually written, which means that whatever bugs GCC has when
parsing a file, these bugs should be reproducible from the generated
header.

> My point was that your foo.cpp doesn't have an #include (or
> #autoinclude) for foo.hpp, and doesn't need one either.
>
> foo.cpp contains all the necessary declarations already - it MUST do,
> or you couldn't generate foo.hpp!
>
> So there's no need for foo.cpp to include foo.hpp (and doing so would
> require the compiler to handle duplicate class definitions, which is
> more implementation work, for no good reason.)
>
>> Can the GCC linker find the symbol Foo::bar() in the above code?
>>
>> I did a test (with mingw), and the result is that if I don't define
>> Foo::bar() outside the class, then the linker doesn't find the
>> function.
>>
>> The same thing happens with Microsoft's compiler.
>
> That's because you've defined Foo::bar as inline but not used it in foo.o

The point though is to avoid writing things twice. For me, the
following is not acceptable:

class Foo {
public:
   void bar();
};

void Foo::bar() {
}

If I have to do the above, I didn't gain anything by the
auto-generated headers. I still have to write things twice. The point
is to generate the header from this class definition:

class Foo {
public:
   void bar() {
   }
};

This is a detail which only a compiler can handle.

>> How much do you spend in maintaining headers? answers welcomed from
>> other members as well.
>
> I don't see how it will save 40% of my time if I only have to edit one
> file instead of two.
> The change still has to be made *somewhere* and I spend more time
> deciding what to change and testing it than I do dealing with
> separating declarations from definitions.
>

The point is not mainly about editing one or two files, but about
avoiding writing (and maintaining) things twice.

Reply via email to