Jump to content
jipete

reserve memory range for function ?

Recommended Posts

jipete

Hello i have question, it's possible to force it to reserve in my programme memory range for a function ?

Func _myfunction()
    Local var1="my data"
    Local $aArray1 = _StringBetween('[18][20][3][5][500][60]', '[', ']')
    _ArrayDisplay($aArray1, 'Default Search')
EndFunc

i want to store var1 and aArray1 to a memory range (of 1mb for example)

 

thank for advance for your help

Share this post


Link to post
Share on other sites
jipete
6 minutes ago, RTFC said:

Do you mean Static declarations? Or allocate storage/data in a (fixed-size) struct?

it's not static because i want to generate a random int number in my function

Share this post


Link to post
Share on other sites
RTFC

I think you might be confusing a Static with a Const(ant) declaration. Did you actually study the linked description? Static means that the function's local variable content is retained between calls to the function, thus (p)"reserving" this memory in a sense. Const, by contrast, just declares a fixed value (meaning if your script tries to change it later, an error is generated). However, if you mean pre-allocation in general, you can predefine your Global/Local $array[<max.number of cells ever>] or string with _StringRepeat(" ",<max.number of chars ever>), for example.

And by the way, Welcome to the forum.:)

Edited by RTFC

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.