Gamestudio Links
Zorro Links
Newest Posts
No connection to MT4
by JeyKey II. 10/29/26 09:34
Zorro plugin for Hyperliquid.xyz
by opm. 10/28/26 13:50
Icon "OP"
by JeyKey II. 10/27/26 07:03
ZorroGPT
by TipmyPip. 10/26/26 08:09
Chat Room for Zorro Programmers
by Haitao_Ren. 10/25/26 03:14
Trading Journey
by Haitao_Ren. 10/25/26 03:14
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (TipmyPip, Quad), 40,433 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
MaliceTheMaker, Haitao_Ren, JimSimons, julienp, julienper
19248 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
String memory allocation #365527
03/27/11 12:23
03/27/11 12:23
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline OP
Serious User
Dark_samurai  Offline OP
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
Hi jcl,

I have a question to the Lite-C compiler. Is this code allowed:

Code:
while(1)
{
STRING* TestStr = "#100";
//...
wait(1);
}



Or do I have to use str_create() instead of "#100"?

Thanks for your help!


ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version
Re: String memory allocation [Re: Dark_samurai] #365654
03/28/11 10:57
03/28/11 10:57
Joined: Jul 2000
Posts: 28,145
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,145
Frankfurt
Yes, you need str_create() inside a function. Also, take care that the string is not created again whenever you call the function - otherwise the memory is slowly consumed up.

On that occasion, I suggest that when you have the choice, prefer create() functions over global definitions. When you want to port your project later to phone APIs such as Android with a future Gamestudio version, you will have to use create functions for engine objects.

Re: String memory allocation [Re: jcl] #365656
03/28/11 11:09
03/28/11 11:09
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Online
Expert
alibaba  Online
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
"When you want to port your project later to phone APIs such as Android with a future Gamestudio version[...]"

When is that possible??!!! Do you have an ETA?


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: String memory allocation [Re: alibaba] #365657
03/28/11 11:19
03/28/11 11:19
Joined: Jul 2000
Posts: 28,145
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,145
Frankfurt
No, there's still a lot to do, we're far from an ETA.

Re: String memory allocation [Re: jcl] #365661
03/28/11 12:05
03/28/11 12:05
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline OP
Serious User
Dark_samurai  Offline OP
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
Ah ok, good to know! Thanks for your help!

Quote:
When you want to port your project later to phone APIs such as Android with a future Gamestudio version, you will have to use create functions for engine objects.


Sounds promising laugh


ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version

Moderated by  old_bill, Tobias 

Gamestudio download | 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