Gamestudio Links
Zorro Links
Newest Posts
Zorro and IB Gateway
by cwford. 04/07/20 00:31
MT4 bridge: Check account number
by tradingest. 04/06/20 12:36
Loging off automatically ?
by jcl. 04/06/20 12:25
zorro contract example
by jcl. 04/06/20 09:22
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
4 registered members (Lozoteva, jbhunter, 3run, Stansmedia), 642 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
vishal, tanhwuser, beo, marsz, gonzalez21
18413 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Inline functions in Lite-C #470541
01/19/18 13:35
01/19/18 13:35
Joined: Jul 2017
Posts: 421
Z
Zheka Offline OP
Senior Member
Zheka  Offline OP
Senior Member
Z

Joined: Jul 2017
Posts: 421
Hello,

Does Lite-C support function definitions as "inline"?

If yes, what's the correct way?

TX!

Re: Inline functions in Lite-C [Re: Zheka] #470552
01/20/18 14:31
01/20/18 14:31
Joined: Sep 2003
Posts: 867
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 867
The lite-C functions are all called, no inline.

Re: Inline functions in Lite-C [Re: Spirit] #470567
01/22/18 03:21
01/22/18 03:21
Joined: Dec 2009
Posts: 127
China
frankjiang Offline
Member
frankjiang  Offline
Member

Joined: Dec 2009
Posts: 127
China
I think Lite-C just Script,so without inline.


development 3d game is interesting!
Re: Inline functions in Lite-C [Re: frankjiang] #470568
01/22/18 08:29
01/22/18 08:29
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
Lite-C does not known "functions" in C-Terms, but only "function pointers".

If you write
Code:
function foo()
{
  error("foo");
}
function bar()
{
  error("bar");
}



you have declared two function pointers foo and bar (which you can swap):

Code:
...
void * tmp = foo;
foo = bar;
bar = foo;

foo(); // will call error("bar")
bar(); // will call error("foo")
...



This allows monkey patching functions for your own needs laugh

Also: Function Prototypes (without definition) will not have the value NULL but a special value that will error "empty function called in ..."


Visit my site: www.masterq32.de
Re: Inline functions in Lite-C [Re: MasterQ32] #471067
02/18/18 14:15
02/18/18 14:15
Joined: Jul 2017
Posts: 421
Z
Zheka Offline OP
Senior Member
Zheka  Offline OP
Senior Member
Z

Joined: Jul 2017
Posts: 421
Oh, nice to know, thanks!

Though my question was rather aiming at avoiding the overhead of usual function calls.

Re: Inline functions in Lite-C [Re: Zheka] #471077
02/18/18 20:04
02/18/18 20:04
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
Quote:
Though my question was rather aiming at avoiding the overhead of usual function calls.

Afaik Lite-C does no optimizations what so ever, so don't get your hopes up


Visit my site: www.masterq32.de
Re: Inline functions in Lite-C [Re: MasterQ32] #471103
02/19/18 20:26
02/19/18 20:26
Joined: Jul 2017
Posts: 421
Z
Zheka Offline OP
Senior Member
Zheka  Offline OP
Senior Member
Z

Joined: Jul 2017
Posts: 421
I don't...already.


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