Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, VoroneTZ), 1,258 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Function pointer in stucts #140062
07/07/07 23:39
07/07/07 23:39
Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
T
TWO Offline OP

Serious User
TWO  Offline OP

Serious User
T

Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
typedef struct
{
void LeftClick();
} AwakeGUI_WindowElement;

function odd();
{
}

AwakeGUI_WindowElement Element;

Element.LeftClick = odd;
Element.LeftClick(); // ERROR

?

Re: Function pointer in stucts [Re: TWO] #140063
07/09/07 11:21
07/09/07 11:21
Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
T
TWO Offline OP

Serious User
TWO  Offline OP

Serious User
T

Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
Waaaaaaaaaaaaah!

Re: Function pointer in stucts [Re: TWO] #140064
07/09/07 11:31
07/09/07 11:31
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
This is no valid C code. In C you can store function pointers in struct elements, but you can't call a struct element.

Re: Function pointer in stucts [Re: jcl] #140065
07/09/07 12:44
07/09/07 12:44
Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
T
TWO Offline OP

Serious User
TWO  Offline OP

Serious User
T

Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
I know I can't treat a void like a function, I posted to get to know how I can archive something similar.

Re: Function pointer in stucts [Re: TWO] #140066
07/09/07 15:20
07/09/07 15:20
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Just as you did, only without the struct.

void LeftClick();
LeftClick = odd;
LeftClick();


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1