Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Nymphodora, Quad), 919 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 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