schwarze@isaak.uucp (Jochen Schwarze) (08/12/89)
Hello!
I just noticed, that it is obviously not possible to declare an
automatic variable of type pointer to function explicitly without
using a typedef. All other cases, both global and local static, and
even automatic declarations using a typedef work as expected.
Look at the following:
int func() { return 0; }
typedef int (*PFI)();
int (*global_explicit)() = &func;
PFI global_typedef = &func;
main()
{
static PFI static_typedef = &func;
static int (*static_explicit)() = &func;
PFI auto_typedef = &func;
int (*auto_explicit)() = &func; // error
}
Although all of the above declarations with initializations seem to
be valid, both AT&T cfront 1.2 and g++ 1.35.0 complain about the
last declaration:
cfront: error: auto_explicit is undefined
g++: `auto_explicit' was not declared
What's wrong about the above code? What am I missing?
Or are the compliers the ones to blame?
Jochen Schwarze, ISA GmbH, Stuttgart, West Germany
UUCP: schwarze@isaak.uucp
BITNET: schwarze%isaak.uucp@unido.bitnet