Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-08-25 21:51:18


On Sunday 25 August 2002 12:15 pm, Edward Diener wrote:
> 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 ?

They are not equivalent. The former is a function type and the latter is a
pointer to a function type. Function types aren't used very often in C++
(actually, I've never needed them before this), and they even have some weird
behavior. For instance:

  void foo(int (int, int));

is equivalent to

  void foo(int (*)(int, int));

because parameters with function type are adjusted to parameters with type
pointer-to-function.

        Doug


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