Re: a compliation error
On Nov 9, 7:29 am, "multics.cn" <multics...@gmail.com> wrote:
I have one line in my cpp source file.
void (**fa)(char,float) = new (void [](char,float));
I tried gcc and vc express, both result in compliation error:
g++ gives:
error: creating array of functions
vc express gives:
error C2092: 'abstract declarator' array element type cannot be
function
Can any one help on the error information?
The error messages seem pretty clear to me. "void
[](char,float)" has the type "array of function...", and you
can't have an array of functions. Given the declaration on the
left, you probably want "void (*[n])(char,float)", and array of
pointers to functions. And you'll have to specify the size of
the array in a new expression, of course. Whence the n.
Much better, of course, would be to use vector:
std::vector< void(*)( char, float ) > v ;
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34