B
Bit byte
I have the ff code:
class MyClass {
public:
....
private:
typedef unsigned int (*hash_func_t) (void *data);
typedef int (*comp_func_t) (void *d1, void *d2);
typedef void (*destroy_func_t) (void *data);
typedef struct {
hash_func_t hash;
comp_func_t cmp;
destroy_func_t destroy;
}TypeFuncs;
TypeFuncs const functionTable[] = { //<- Compiler barfs here
//NOP
{},
//ID_STRING
{ (hash_func_t) &str_hash, (comp_func_t) &str_cmp, (destroy_func_t),
&str_destroy },
//STRING_ID
{ (hash_func_t) &int_hash, (comp_func_t) &int_cmp, (destroy_func_t),
&int_destroy },
//CONTRACT_DETAILS
{ (hash_func_t) &contract_hash, (comp_func_t) &contract_cmp,
(destroy_func) &contract_destroy },
...
};
};
Error msg:
syntax error : '{'
error C2334: unexpected token(s) preceding '{'; skipping apparent
function body'
This is a straight forward array initialization - why am I getting
compilation errors?
class MyClass {
public:
....
private:
typedef unsigned int (*hash_func_t) (void *data);
typedef int (*comp_func_t) (void *d1, void *d2);
typedef void (*destroy_func_t) (void *data);
typedef struct {
hash_func_t hash;
comp_func_t cmp;
destroy_func_t destroy;
}TypeFuncs;
TypeFuncs const functionTable[] = { //<- Compiler barfs here
//NOP
{},
//ID_STRING
{ (hash_func_t) &str_hash, (comp_func_t) &str_cmp, (destroy_func_t),
&str_destroy },
//STRING_ID
{ (hash_func_t) &int_hash, (comp_func_t) &int_cmp, (destroy_func_t),
&int_destroy },
//CONTRACT_DETAILS
{ (hash_func_t) &contract_hash, (comp_func_t) &contract_cmp,
(destroy_func) &contract_destroy },
...
};
};
Error msg:
syntax error : '{'
error C2334: unexpected token(s) preceding '{'; skipping apparent
function body'
This is a straight forward array initialization - why am I getting
compilation errors?