Errors, bugs, questions - page 1648
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Isn't that how the current 0 works?
In general, there is a lot of confusion there, we can't know the real size of the allocated memory for the array to check it and optimize it.
If I remember the explanation correctly, the reserve size will not decrease even if it is explicitly given a smaller number.
Wrong. Judging from the help example, 0 does indeed work as 0 and then the -1 suggestion makes a lot of sense.
And I will rephrase my suggestion about ArrayResize as follows: when specifying reserve_size=-1, the function must not change the memory size allocated for the array if the size parameter lies within this range. If size > capacity, the buffer will grow of course.
The logic for working with allocated (conditional code):
The array ("inside") stores how many elements the array is allocated to.
The logic of working with allocated (conditional code):
I see, thank you. And in the beginning this allocated is equal to -1, or not? I.e. at initial call of ArrayResize(arr, 0, 100) allocation will be?
Is this allocated at the beginning equal to -1, or not?
I.e. when ArrayResize(arr, 0, 100) is called initially, will allocation occur?
The allocation only happens if the size of the array changes upwards. In this case, the size of the array doesn't change, because it was equal to 0.
The difference is that in the first case there is no error :)