|
Boost : |
From: Douglas Gregor (gregod_at_[hidden])
Date: 2000-11-19 19:22:57
On Sun, 19 Nov 2000 09:22:52 -0800
Karl Nelson <kenelson_at_[hidden]> wrote:
> 5) Generate readable errors.
>
> Okay this was the tall order. Gtk-- is not supposed to
> be hyper advanced C++. It was meant for people constructing
> GUIs who used Qt. They may be experts but more likely
> they are a bit green. In the design of the library, I
> wanted to isolate the errors. Thus rather the spitting out...
>
> on line (From boost/Callback)
> s=mul_to_int(); // where mul_to_int doesn't take right arguments
>
> boost/callback.hpp: In method `int boost::detail::functor_callback_impl<2>::base<mul_to_int,int,float,float,boost::detail::Unused>::operator ()(float, float)':
> boost/callback.hpp:461: instantiated from here
> boost/callback.hpp:256: no match for call to `(mul_to_int) (float &, float &)'
> callback1.cpp:13: candidates are: int mul_to_int::operator ()(float, float, bool
>
>
> SigC spits out
>
> on line
> s=slot(&mul_to_int);
>
> test.cc:8: no match for `SigC::Slot2<int,float,float> & = SigC::Slot3<int,float,float,bool>'
> /usr/local/include/sigc++/slot.h:489: candidates are: class SigC::Slot2<int,float,float> & SigC::Slot2<int,float,float>::operator =(const SigC::Slot2<int,float,float> &)
>
> Likely this last one isn't an issue to you. But to my users it
> really is important.
I consider it an issue, but I know it is also solvable. I've just uploaded an updated version of a callback library which emits more readable error messages, e.g., the following code
struct hello_world {
int operator() { return 5; }
};
// ...
callback<void> cb1;
cb1 = hello_world();
Will return this error message with g++-2.95.2:
callback1.cpp:22: instantiated from here
../../boost/callback.hpp:236: `function_call_operator_signatures_are_not_compatible_with_callback' is not a member of type `boost::INVALID_CALLBACK_TARGET<hello_world>'
More metaprogramming could yield more accurate error messages, but VC++ has become the limiting factor.
Doug Gregor
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk