Gamestudio Links
Zorro Links
Newest Posts
folder management functions
by 7th_zorro. 04/16/24 13:19
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
LPDIRECT3DCUBETEXTUR
E9

by Ayumi. 04/12/24 11:00
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 04/11/24 14:56
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (7th_zorro, Aku_Aku, VoroneTZ, 11honza11), 376 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
11honza11, ccorrea, sakolin, rajesh7827, juergen_wue
19045 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: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
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: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
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: 128
China
frankjiang Offline
Member
frankjiang  Offline
Member

Joined: Dec 2009
Posts: 128
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: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
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: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
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