This is the mail archive of the libstdc++@sources.redhat.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: C++ and useful error messages


On Thursday 21 December 2000 17:05, Joe Buck wrote:

> Finally, as I suggested before, for any undeclared identifier, we can
> look in std:: and report an additional "perhaps you meant" message if
> found there.

Something of the form of

std::vector<int> a;

without the appropriate declaration being visible results in "`vector' 
undeclared in namespace `std'" which is about perfect to me; if we could get 
to somehow do something similar when the namespace isn't prefixed, some sort 
of implicit prefixing of the current namespace, that would be ideal. ie

vector <int> a;

would give something like "`vector' undeclared in namespace `global'" (or 
whatever we call that) and

namespace app
{
vector<int> a;
}

would result in "`vector' undeclared in namespace `app'" and

namespace
{
vector<int> a;
}

would result in "`vector' undeclared in namespace `anonymous'" (or whatever) 
and if it then searched all[*] the currently visible namespaces for likely 
candidates to suggest that would be just gravy.

[*]
There might be more than one possible candidate; if a user has

#include <vector>
namespace cartesian
{
template <unsigned, typename T> struct vector {/*...*/}
}

std::vector <vector <3, double> > Table;

the user might well be nonplused if the compiler suggests std::vector...

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]