/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / Function pointer: how does it work with circleOS ?

Username:     
Password:     
             

Forum
  • Index
  •  » circleOS
  •  » Function pointer: how does it work with circleOS ?

# 1   2010-06-01 14:20:34 Function pointer: how does it work with circleOS ?

matmout
Member
From: Grenoble
Registered: 2010-05-10
Posts: 12

Function pointer: how does it work with circleOS ?

Hello,

I need a function to register an handler :

Code:

void SetHandler(u32 handler)
{
    MyHandler = handler;
}

Next I would like to call that function using something like this :

Code:

(void (*)(char)) (MyHandler)(c);

But, it doesn't compile sad

Can someone give me an example ?

Thank you in advance

Offline

 

# 2   2010-06-01 14:31:48 Function pointer: how does it work with circleOS ?

ntrf.zns
Member
From: Belgorod, Russia
Registered: 2009-11-01
Posts: 134

Re: Function pointer: how does it work with circleOS ?

move some parenthesis

Code:

((void (*)(char)) MyHandler)(c)

Casts are always right-to-left. What you wrote is the cast of function call result.

Last edited by ntrf.zns (2010-06-01 14:35:21)

Offline

 

# 3   2010-06-01 21:50:27 Function pointer: how does it work with circleOS ?

matmout
Member
From: Grenoble
Registered: 2010-05-10
Posts: 12

Re: Function pointer: how does it work with circleOS ?

Thanks a lot ! It was a really ugly mistake wink

Offline

 

  • Index
  •  » circleOS
  •  » Function pointer: how does it work with circleOS ?

Board footer