Boost logo

Boost :

From: Edward Diener (eddielee_at_[hidden])
Date: 2002-08-25 11:15:21


I always though that "int (int,int)" was not a valid type while "int
(*)(int,int)" was a valid type. Are they equivalent to each other ? If so,
is this the way C++ has been for awhile or is it new to the official 1998
C++ standard ?

I think that is the reason I was confused when you altered the syntax to
boost::function to take the entire function type as a single template
parameter as opposed to the return type and parameter types as separate
template parameters.

I would be surprised if any compilers did not recognize the second form and
am surprised that many recognize the first, but if it is valid C++ of course
they should.

"Douglas Paul Gregor" <gregod_at_[hidden]> wrote in message
news:Pine.GSO.4.31.0208250944550.3604-100000_at_eggbeater.cs.rpi.edu...
> On Sun, 25 Aug 2002, John Maddock wrote:
> > OK I accept that the syntax you propose is cleaner - but the lib isn't
> > broken with Borland's compiler - it just needs a workaround applying in
use.
>
> I think this is a classic case of the cure being worse than the disease.
> The workaround doubles the amount of effort, for what purpose?
> Boost.Function still supports the numbered versions for compilers broken
> in this respect, e.g.:
>
> function2<int, int /*x*/, double /*y*/> foo;
>
> > Seriously, almost no compilers support the syntax you are using, will
anyone
> > actually use boost.function or boost.signals if it just looks as though
it
> > is broken on all the major compilers?
>
> EDG-based compilers are fine (tested on Comeau, SGI, Compaq, and Intel),
> as are all versions of GCC from 2.95 on (check the Function tutorial in
> CVS for a list of compilers that have been tested).
>
> I think this is the case for XFAIL, or at least some form of test
> annotation that can say "this test checks for a specific feature X; the
> library can work without X, but you've been warned". For instance with
> Boost.Function, allocator_test has always failed under MSVC but nobody
> particularly cares because allocators are rarely used (in my
> experience...). Now, function_test will fail on a few compilers, but it
> doesn't hurt users much because they can still use the older alternative
> syntax.
>
> > One other question: is the syntax you
> > are using actually legal - I refer to the placement of a named parameter
> > within a typename:
> >
> > boost::function<int (int, double)> // no quibbles
> > boost::function<int (int a, double b)> // is this really legal?
>
> Yeah, it's legal. 8.3.5/8 says:
> "An identifier can optionally be provided as a parameter name; if
> present in a function definition (8.4), it names a parameter (sometimes
> called formal argument )...."
>
> Doug
>
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
>


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