I use function pointers to loop through state machines.
They are declared global as:

void (*mdb_thread)(void);
void (*main_thread)(void);

Following code is problematic:

// wait for transmission completed and start timeout then
void mdb_watch_transmit(void)
{
    if(transmit_ok)
    {
        timeout_start_5s();
        transmit_ok = 0;
        mdb_thread = &mdb_watch_after_transmit();
    }
}

// wait for timeout or reception of data
void mdb_watch_after_transmit(void)
{
    if( timeout() )
    {
        main_thread = &reset();
        mdb_thread = &mdb_watch_transmit(); // famous line 79 from the error
    }
}

The function prototypes exist in a header file included in the c file.

The error:

mdb_rs232.c:79: error 47: indirections to different types assignment
from type 'void near* '
to type 'void function    ( )  code* '
make: *** [mdb_rs232.rel] Error 1

In the first function he doesn't complain but in the second he does :s
As far as i can see i do nothing different, just passing the adres of a
function to it and both functions are the same type (void/void) so i can't
see whats the problem.

The function pointers are executed in a while 1 loop in the main function in
another file, there are those pointers prototyped but with the extern
keyword since i declare them in this file where the functions are written.

Any thoughts?

Cheers

Bart
------------------------------------------------------------------------------
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to