Boost logo

Boost :

From: Douglas Paul Gregor (gregod_at_[hidden])
Date: 2002-08-24 09:18:39


On Sat, 24 Aug 2002, John Maddock wrote:
> > function_test. Borland (like so many other compilers...) can't parse
> function
> > types like "int ()" or "float (int x, int y)" (Borland parses the former
> as
> > "int", causing the error you see).
> >
> > This is one of those cases where XFAIL tests would be nice :)
>
> No need I have a fix: the trick is to replace your function types with
> typedefs:
>
> typedef int zero_arg_function_type(void);
> typedef int one_arg_function_type(int);
>
> once you do this everything is fine with Borland. BTW is_function_test.cpp
> is using this trick and it does seem to be well supported by current
> compilers. You may want to look at function_test as well if that's failing
> for the same reason; the full diff is below, let me know if you want me to
> check it in.

That defeats the purpose of the new syntax :) We want:

  boost::function<int (int x, int y)> f;

Approximating this with a typedef will make it work, but it won't be
usable. Approximating this with a typedef in function_test would be very,
very bad: it gives the impression that everything is fine on a compiler
when in fact the compiler is very broken for typical uses of the library.

Within is_function_test.cpp it is reasonable to use the typedef approach,
because there are many cases where function types come up without being
introduced with the poorly-supported syntax needed by Function.

        Doug


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