Well here are the mistakes. Citizens of Metaquotes, please pay attention !!!
int j[1];
Alert("Размер массива из одного элемента без списка инициализации = ", sizeof(j), " Массив динамический? ", ArrayIsDynamic(j));
int k[];
Alert("Размер структуры для динамического массива = ", sizeof(k), " Массив динамический? ",ArrayIsDynamic(k));
int g[] = {0};
Alert("Размер массива из одного элемента со списком инициализации = ", sizeof(g), " Массив динамический? ",ArrayIsDynamic(g));
The essence of the error: when an initialization list (int g[] = {0}; ) is used for an array, thesizeof(g) function gives the size of struct MqlArrayObject (created for a dynamic array).
220Volt: The essence of the error: when an initialization list (int g[] = {0}; ) is used for an array, thesizeof(g) function prints the size of struct MqlArrayObject (created for a dynamic array).
And at the same time, ArrayIsDinamic() says that the array is static?
Well here are the mistakes. Citizens of the Metacities, please pay attention !!!
The essence of the error: when an initialization list (int g[] = {0}; ) is used for an array, functionsizeof(g) gives out the size of struct MqlArrayObject (created for dynamic array).
Thank you for the message, the error has been corrected.
Renat, I have a suggestion for a long time, just on the subject. Please make a named typing for arrays, at least for static ones (all other types already have it).
That is, you may declare for example: typedef Int8 = int[8];.
The price of the question is the possibility to pass one-dimensional (2, 3-dimensional) arrays, which are subarrays in arrays of larger size, into functions.
I.e. if you declare : Int8 arr[...] further, you can pass arr[i] into function func(Int8 &a) {...}.
Currently, I have to perform a lot of extra actions in mql5 and write a lot of ugly code due to impossibility to pass subarrays into functions.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
OK, I'm off. :) I'm also outside the terminal.
Checked elementary - trying to use ArrayResize(...)
It's elementary to try to use ArrayResize(...)
Well here are the mistakes. Citizens of Metaquotes, please pay attention !!!
The essence of the error: when an initialization list (int g[] = {0}; ) is used for an array, thesizeof(g) function gives the size of struct MqlArrayObject (created for a dynamic array).The essence of the error: when an initialization list (int g[] = {0}; ) is used for an array, thesizeof(g) function prints the size of struct MqlArrayObject (created for a dynamic array).
And ArrayIsDinamic() says that the array is static?
j - static
k - dynamic
g - static
....
g - static
Well here are the mistakes. Citizens of the Metacities, please pay attention !!!
The essence of the error: when an initialization list (int g[] = {0}; ) is used for an array, functionsizeof(g) gives out the size of struct MqlArrayObject (created for dynamic array).Thanks for the message, error corrected.
Ilyas!!! Wait a minute!!!
How exactly was it fixed? Did the arrays that were parsed in the declaration become dynamic (resizable)?
Or completely static?
Or is it completely static?
It's a static code, of course.
Oh, now I see.
Renat, I have a suggestion for a long time, just on the subject. Please make a named typing for arrays, at least for static ones (all other types already have it).
That is, you may declare for example: typedef Int8 = int[8];.
The price of the question is the possibility to pass one-dimensional (2, 3-dimensional) arrays, which are subarrays in arrays of larger size, into functions.
I.e. if you declare : Int8 arr[...] further, you can pass arr[i] into function func(Int8 &a) {...}.
Currently, I have to perform a lot of extra actions in mql5 and write a lot of ugly code due to impossibility to pass subarrays into functions.
I don't write in servicedesk, because the topic seems debatable to me.