Gamestudio Links
Zorro Links
Newest Posts
Blind Zorro Window
by Martin_HH. 09/13/26 13:20
Parent/child object
by 3run. 09/11/26 06:21
ZorroGPT
by TipmyPip. 09/09/26 14:35
[MED] Import from FBX (2010) missing!!!
by USER0328. 09/03/26 18:03
Purchase A8 full licence version
by ukgamer. 08/30/26 14:27
Retrieve optimize() variables order (edited)
by NorbertSz. 08/25/26 13:24
Max Number of Strategies in /Strategy folder
by Martin_HH. 08/17/26 07:54
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
0 registered members (), 1,394 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
speedx, liop, Bauer097, riggi89, shuhari
19233 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,133
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,133
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 Offline
Expert
alibaba  Offline
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,133
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,133
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