David Ching said:
It shouldn't matter what directory the header is in. But
VC++ maintains dependency info on a very fine basis. For
example, if you change a protected member of a class in
the .h, it won't compile the .cpp files that include the
class because it knows that protected members can't be
accessed outside of the class so there is no need to
recompile code outside of the classs.
It looks like quite dangerous decision. Protected members,
while being inaccessible, are perfectly visible for user's
code and participate in member call resolution. Access
rights are apllied afterwards. For example:
class X
{
public:
void f(double) {}
protected:
void f(const char*) {}
};
int main()
{
X x;
x.f(42);
x.f(3.14);
return 0;
}
The code above compiles as expected. Now if I change
protected `f' from
void f(const char*) {}
to
void f(int) {}
The `x.f(42);' statement won't compile anymore since
protected member function `void f(int)' participates in call
resolution and matches better than `void f(double)'.
Now, if compiler doesn't recompile corresponding .CPP file,
then the above compilation error will lurk untill full
rebuild. So, developer can continue with other tasks for a
long time without even knowing that there is an error.
Alex