← Back to team overview

kicad-developers team mailing list archive

Re: I really *love* STL error messages


On 03/26/2012 08:53 AM, Lorenzo Marcantonio wrote:
> On Sat, Mar 24, 2012 at 08:43:53AM +0100, Lorenzo Marcantonio wrote:
>> I'll look into it. 4.6 gave me 'trouble' even with other stuff (not its fault: it's only more strict). In fact the '-fpermissive' option probably can be used to turn the error in a warning.
> It is actually pretty easy...
> The declaration
>    WX_DECLARE_HASH_MAP(char*, EDA_RECT, wxStringHash, wxStringEqual, RECT_MAP );
> makes a typedef (I thing) for map from a char* to an EDA_RECT; then when you do:
>    const char* classname = typeid(*this).name();
> // ...
>    EDA_RECT r = class_map[ classname ];
> ... you're passing a const char* to a function accepting a char*, which
> is not allowed (it can do evil things on the contents, for example; you
> also can overload or specialize on const specifiers!)
> The solution is simply to use...
> WX_DECLARE_HASH_MAP(const char*, EDA_RECT, wxStringHash, wxStringEqual, RECT_MAP );

That's what I would have thought, but this does not compile here.  (Some paths of the
preprocessor are supplying the "const" behind the scenes.)

So this is not a universal solution.  Again, what version of wx are you using?  There are
a number of ways to get a hashtable, so I'd like to measure what our confidence in this wx
header file should be.  To do that, I need to know the revision of wx that you are using.