Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (AndrewAMD, TipmyPip, OptimusPrime), 15,359 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: An Example Please :) [Re: Uhrwerk] #411532
11/17/12 15:17
11/17/12 15:17
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
I don't get it (._.)


POTATO-MAN saves the day! - Random
Re: An Example Please :) [Re: Kartoffel] #411533
11/17/12 15:20
11/17/12 15:20
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
void TestFunction() returns void.

void * temp_void(); is the wrong signature for TestFunction as the return type here is void*.

The correct return type would be void because that is exactly what TestFunction returns.

So your example should be:
Code:
#include <acknex.h>

void TestFunction()
{
	error("TestFunction was called");
}

void CallFunc(void * func)
{
	void temp_void();
	temp_void = func;
	
 	if(temp_void) { temp_void(); }	
}

void main()
{
	CallFunc(TestFunction);
}



Always learn from history, to be sure you make the same mistakes again...
Re: An Example Please :) [Re: Uhrwerk] #411535
11/17/12 15:23
11/17/12 15:23
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
well... thank you grin

so then it should be (in my first example)
Code:
#include <acknex.h>

int * p(); //                   >> without the * <<
int _function()
{
	error("works now.");
}

void main()
{
	p = _function;
	p();
}


Last edited by Kartoffel; 11/17/12 15:25.

POTATO-MAN saves the day! - Random
Re: An Example Please :) [Re: Kartoffel] #411541
11/17/12 15:31
11/17/12 15:31
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
You did not correct the code, just wrote a comment to it, right?


Always learn from history, to be sure you make the same mistakes again...
Re: An Example Please :) [Re: Uhrwerk] #411543
11/17/12 15:35
11/17/12 15:35
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
...yes, I wanted to mark the line that I meant.


POTATO-MAN saves the day! - Random
Re: An Example Please :) [Re: Kartoffel] #411544
11/17/12 15:37
11/17/12 15:37
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Ok. Sorry, I got confused. grin


Always learn from history, to be sure you make the same mistakes again...
Re: An Example Please :) [Re: Uhrwerk] #411546
11/17/12 15:44
11/17/12 15:44
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
nevermind smile

...but seriously, especially the pointer workshop in the official tutorial needs MUCH MORE precise information about pointers.
Neither in the Tutorial nor in the Manual I have read any of the information about pointers that I've learned in this thread.


POTATO-MAN saves the day! - Random
Re: An Example Please :) [Re: Kartoffel] #411547
11/17/12 15:52
11/17/12 15:52
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
The tutorial is basically a rough overview of the most basic things. It's sufficient to get your feets wet. But if you're serious about learning programming you better watch somewhere else. A good C book should do the trick.

On the one hand I think that the turial really falls off to short on this topic. On the other hand multiple indirections, pointer arithmetics and all that stuff might do no good for a beginner.


Always learn from history, to be sure you make the same mistakes again...
Re: An Example Please :) [Re: Uhrwerk] #411549
11/17/12 16:03
11/17/12 16:03
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Originally Posted By: Uhrwerk
On the other hand multiple indirections, pointer arithmetics and all that stuff might do no good for a beginner.
Indeed, this would only irritate and confuse new users.

...I think Something like a new page (or forum) here, where the whole community can provide their own
descriptions / tutorials / workshops about all the stuff that isn't named in the official workshops wouldn't be a bad idea.


POTATO-MAN saves the day! - Random
Re: An Example Please :) [Re: Kartoffel] #411551
11/17/12 16:07
11/17/12 16:07
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Originally Posted By: Kartoffel
...I think Something like a new page (or forum) here, where the whole community can provide their own
descriptions / tutorials / workshops about all the stuff that isn't named in the official workshops wouldn't be a bad idea.

In theory, that would be the Wiki. But without enforced peer review or incentive, I don't see any quality content up there in the future.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Page 2 of 2 1 2

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

Gamestudio download | 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