views:

876

answers:

2

I am trying to declare a callback routine in C++ as follows:

void register_rename (int (*function) (const char *current, const char *new));
    /*------------------------------------------------------------*/
    /* WHEN:  The callback is called once each time a file is received and
     *   accepted.   (Renames the temporary file to its permanent name)
     * WHAT:  Renames a file from the given current name to the specified new name.
     */

However, I get the following error:

line 204: error #70: 
      incomplete type is not allowed
void register_rename (int (*function) (const char *current, const char *new));

I'm not sure how to correct this. I have other similar callback routines declared in the same header file, and I do not get this error.

Please help! :)

+15  A: 

You cannot use new because it is a keyword. Try to pick a valid identifier for your second argument.

anthares
+2  A: 

You cannot name a variable (or any identifier) with a reserved word;

reserved words are keywords

asm do if return try
auto double inline short typedef
bool dynamic_cast int signed typeid
break else long sizeof typename
case enum mutable static union
catch explicit namespace static_assert unsigned
char export **new** static_cast using
class extern operator struct virtual
const false private switch void
const_cast float protected template volatile
continue for public this wchar_t
default friend register throw while
delete goto reinterpret_cast true

and alternative names of some operators

and and_eq bitand bitor compl not
not_eq or or_eq xor xor_eq
f4