Watcom warning

Hi, All!

I wrote follow code in watcom 10.6:

void* data;
register void (* )(lex*,void*) pfunc;

pfunc=(void (* )(lex*,void*))data;
pfunc(NULL,NULL);


When I compile this, compiler printed some warnings: W594, W604. The
watcom documentation didn’t explain problem and it refer to ARM page.
93.
Are there anybody, who can explain problem and get solution.

Eugene

“Eugene Kislov” <KislovEA@asutp.yorp.yaroslavl.ru> wrote in message
news:3B529255.15BB5C3@asutp.yorp.yaroslavl.ru

Hi, All!

I wrote follow code in watcom 10.6:

void* data;
register void (* )(lex*,void*) pfunc;

This line isn’t legal has far as I know. It should be
register void (pfunc) (int, void*);

pfunc=(void (* )(lex*,void*))data;
pfunc(NULL,NULL);


When I compile this, compiler printed some warnings: W594, W604. The
watcom documentation didn’t explain problem and it refer to ARM page.
93

These are C++ warning. You have to look in the C++ part of the manual.

What these warning say it the compiler cannot tell if the statement is a
declaration
or an expression and it must analyse some more of the source to figure it
out.

To get around this problem I use typedef (I’m not sure this is the clean
solution).
So your code would become

typedef void ( *pfunc_t)( lex *, void *);

void* data;
pfunc_t pfunc; // note that I haven’t include register as it’s totaly
useless with watcom
// When optimisation is used the compiler will
evaluate which variable
// is best put in a register. With today’s
complexe processors compiler
// usually does a better job at this then human
:wink:

pfunc = ( pfunc_t) data;
pfunc( NULL, NULL)

Are there anybody, who can explain problem and get solution.

Hope that helps!

Eugene