|
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
Expert
|
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:
#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
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
well... thank you  so then it should be (in my first example)
#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
Expert
|
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]
#411546
11/17/12 15:44
11/17/12 15:44
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
nevermind  ...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
Expert
|
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
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
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
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
...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
|
|
|
|