-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of WangYun Sent: Tuesday, November 16, 2004 10:03 AM To: boost-users Subject: [Boost-users] Signal with return value will crash
I tried the signals, the code below will crash
#include
int _tmain(int argc, _TCHAR* argv[]) { boost::signal _sig; _sig(10); return 0; }
but code below works well
#include
int _tmain(int argc, _TCHAR* argv[]) { boost::signal _sig; _sig(10); return 0; }
The only difference is one has return value, the other doesn't, is
Hello, I was just reading some mention of bugs in boost::signal, is this implementation in competition with libsigc++? i.e. does it aim to do the same job, but under a different license, or is there perhaps some fundamental design difference between the two? Maybe it's a totally unrelated library (it doesn't look that way, but still ...). Either way, thank you for any information. Regards gaz -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Nat Goodspeed Sent: 17 November 2004 13:39 To: boost-users@lists.boost.org Subject: RE: [Boost-users] Signal with return value will crash this a
bug or by design?
[Nat] The difference between a void slot and one with a return value is that in the latter case, the signal needs a combiner to figure out what to do with multiple returns from multiple slots. See: http://www.boost.org/doc/html/ch06s02.html#id2520177 I haven't actually tried your example, but it looks to me as though the default combiner isn't working for you. But then you probably want something other than the default anyway -- unless you don't care about the values returned by your slots -- in which case why not use void slots? _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On Nov 17, 2004, at 9:20 AM, Foster, Gareth wrote:
I was just reading some mention of bugs in boost::signal,
They weren't actually bugs :)
is this implementation in competition with libsigc++? i.e. does it aim to do the same job, but under a different license, or is there perhaps some fundamental design difference between the two?
The Signals library aims to be much more flexible than libsigc++ and to have an interface that is more comfortable for Boost. For instance, slots are just function objects with similar signatures (like Boost.Function, because Function is used in Signals), one can combine the results of calling multiple slots into a single return value via an arbitrary function object, and the lifetime of signals & slots is automatically tied to "trackable" objects used in bind expressions to build slots. Basically, libsigc++ is a monolithic entity covering single and multiple-target callbacks, slots, and slot binding, Signals tackles only the multiple-target callbacks, relying on other Boost libraries (especially Function and Signals) to do most of the work, so it integrates cleanly with the rest of Boost. Doug
participants (2)
-
Doug Gregor
-
Foster, Gareth