Boost logo

Boost :

From: Philip Nash (philip.nash_at_[hidden])
Date: 2001-10-30 08:43:47


From: Peter Dimov [mailto:pdimov_at_[hidden]]
> From: "Philip Nash" <philip.nash_at_[hidden]>
> > Hmm, interesting - thanks for the reply and example, btw.
> > Are you compiling that with MSVC, though?
>
> Yes. :-)
>
> > I did actually try that (if I have understood correctly).
> > I have reduced my attempt down to this example:
> >
> > int __stdcall AddFn( int x, int y )
> > {
> > return x+y;
> > }
> > void SomeOtherFunction()
> > {
> > boost::bind<int>( &AddFn, 2, 3 ); // compiler error here
> > }
> >
> > And I am still getting a compiler error "type 'int' unexpected" ???
>
> Works for me in both VC6 and VC7b2. Looks like you've some other problem
> (there is a "special" VC section in the documentation.) This syntax is ery
> fragile on VC; 'using boost::bind' breaks it, as does having a class
> template named 'bind' _in any namespace_.
>
> > As for the "interesting extension", could it be accomplished as an
> adapter?
> > You obviously wouldn't want __stdcall, or other proprietry extensions
> > polluting the bind interface, but as a seperate adapter...?
>
> It probably can but it's not worth it. :-)

:-( fair enough!

Yeah, I did read the "special" VC section (and wept), but I could see any
connection, in this case at least. But as you say, the "syntax is very
fragile on VC", so I experimented a bit more... creating a brand new console
application and _just_ adding my code fragment above - it _did_ work. Sorry!
I should have done that before (I still had a little other test code
around)...
Anyway, I was able to break it by adding a using boost::bind and ommitting
the boost prefix, as suggested. That gave me the same "type 'int'
unexpected" error (as it was obviously picking up some other bind
somewhere), and using the reDEFINE hack fixed it.
I'm now trying to scale it up to see if it fixes my real application issue..
but I'm having other problems now (not with bind), so I'll get back to you
on that...

Thanks for your help,

[)o
IhIL..


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk