Gamestudio Links
Zorro Links
Newest Posts
zorro license, IB connection
by miwok. 12/06/23 16:32
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
6 registered members (miwok, AndrewAMD, TipmyPip, 3run, Quad, 1 invisible), 645 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
void* or function? #418493
02/25/13 16:04
02/25/13 16:04
Joined: Nov 2007
Posts: 318
Brasil, Paraná
NeoNeper Offline OP
Senior Member
NeoNeper  Offline OP
Senior Member

Joined: Nov 2007
Posts: 318
Brasil, Paraná
what is the difference between void * and function?
When should I use void * and when should I use function?


Please! Use easy words to be translated. because my English is not very good! Grateful.
_______________________________________________________
Re: void* or function? [Re: NeoNeper] #418494
02/25/13 16:17
02/25/13 16:17
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
These are two different data types. "function" means that you return a var/fixed variable. "void*" means that you want to return a pointer to something. I'll give you an example:
Code:
function foo()
{
   return 1.337; // Alright
   // return bmap_create("lol.dds"); Not ok. foo should return a number.
}

void* bar()
{
   // return 1337; Don't do this. You should return an address.
   return &video_mode; // Ok. void* is correct. int* would be even more precise.
}


Also see the manual concerning data types.


Always learn from history, to be sure you make the same mistakes again...
Re: void* or function? [Re: NeoNeper] #418495
02/25/13 16:18
02/25/13 16:18
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Originally Posted By: NeoNeper
what is the difference between void * and function?
When should I use void * and when should I use function?


First of all, void * and void is a difference.
void * can return a pointer, void not. Also function can always return something, so it seems that function is something like var.

Last edited by Ch40zzC0d3r; 02/25/13 16:18.
Re: void* or function? [Re: Ch40zzC0d3r] #418497
02/25/13 16:23
02/25/13 16:23
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Originally Posted By: Ch40zzC0d3r
so it seems that function is something like var.
grin

Function is not something like var, it is exactly var. It all comes down to the fixed type. var is fixed and function is var. You can see all this in acknex.h.


Always learn from history, to be sure you make the same mistakes again...
Re: void* or function? [Re: Ch40zzC0d3r] #418498
02/25/13 16:25
02/25/13 16:25
Joined: Nov 2007
Posts: 318
Brasil, Paraná
NeoNeper Offline OP
Senior Member
NeoNeper  Offline OP
Senior Member

Joined: Nov 2007
Posts: 318
Brasil, Paraná
Ohhhhh i Understand. Tanks mans.
I'll review my scripts from now on!
I used functions for all LOL!


Please! Use easy words to be translated. because my English is not very good! Grateful.
_______________________________________________________
Re: void* or function? [Re: Ch40zzC0d3r] #419203
03/07/13 19:57
03/07/13 19:57
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
Originally Posted By: Ch40zzC0d3r
Originally Posted By: NeoNeper
what is the difference between void * and function?
When should I use void * and when should I use function?


First of all, void * and void is a difference.
void * can return a pointer, void not. Also function can always return something, so it seems that function is something like var.


type name (parameter1, parameter2, ...) { command1; command2; ... }
type is the type of the variable (such as var, int, float...) that the function returns to the caller. If the function returns a var, or returns nothing, you can write just function instead of the type.
..............
void:
When used as a function return type, the void keyword specifies that the function does not return a value. When used for a function's parameter list, void specifies that the function takes no parameters.

void*:
A void pointer can be converted into any other type of data pointer.


Compulsive compiler

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