Errors, bugs, questions - page 3012

 
Andrei Trukhanovich:

the help does not agree with this interpretation.

The help is written for mql and mql is written in ci ))
Knowing the basics of c, it will be clear what's what.

 
Roman:
I think it's simple - you didn't understand what the help said
 
Andrei Trukhanovich:
I think it's simple - you didn't understand what the help said

By and large, it is not correct!

 
Roman:

By and large, it is not correct!

I'm not going to argue about that.

 
Roman:

The help is written for mql, and mql is written in ci ))
If you know the basics of C, you'll know what's what.

In C, the sizes of an array and a string are unknown beforehand, while in MQL they are known - this is a significant difference - hence, in MQL, the redundant parameters that duplicate them are not needed.

 
A100:

In C, the size of the array and string are unknown in advance, while MQL is known - this is a significant difference - so in MQL you don't need redundant parameters duplicating them.

A dynamic array is dynamic, and that's why it expects the user to get any size.
In order for a dynamic array to understand what he wants, the programmer should tell him:

-Hey, dynamic array, I want to send you data.
and he answers:
-And what type and size of your data?
you tell him:
-Look, char 100 elements
he answers:
-Okay, if I'm the same type, allocate memory of 100 bytes for these elements and then send it. Otherwise I will not accept it.

;))

But you have made life easier by specifying even zero in the parameter, the process automation itself will calculate the size of the data to be transferred.
So to say additional protection against newcomers. But it is better to pass size explicitly to control it, otherwise you will have trouble debugging it later.
 
Roman:

A dynamic array is dynamic because it expects the user to get any size.
For a dynamic array to understand what it wants, the programmer should tell it:

-Hey, dynamic array, I want to send you data.
and it will tell you:
-How big is your data?
you tell it:
-Here, 100
it will tell you:
-Okay, allocate me memory for 100 elements, and then send it. Otherwise I won't accept it.

;))

But you have simplified your life by specifying even zero in the parameter, the process automation itself will calculate the size of the transferred data.
So to say additional protection against newcomers. But it is better to pass size explicitly to control it, otherwise you will have trouble debugging it later.

Frankly speaking, this is a cruelty in critical cases for an array. what we see in the form of an overrun of a dynamic array.... although under normal circumstances it's convenient...

 
Valeriy Yastremskiy:

to be honest, this is a tantrum in critical cases for an array. as we see in the form of an output beyond the size of the dynamic array.... although it is convenient under normal conditions...

Array overrun, that's programmer's level ))

 
Roman:

Entering outside the array is a programmer's level ))

this is a common situation when the history bars are not fully loaded. the classic check for loading the history by the window width is also not always relevant.

And this is not always the level of the algorithmist, especially if the situation is low-frequency.

 
Valeriy Yastremskiy:

This is a common situation when the history bars are not fully loaded. the classic check for loading the history by window width is not always relevant either.

and it is not always the level of the algorithmist, especially if the situation is low-frequency.


Doesn't it help?
Only this is a peculiarity of the MT5 platform, not the basics of the language.
If that doesn't help, then you should probably inform the developers.

Документация по MQL5: Доступ к таймсериям и индикаторам / Организация доступа к данным
Документация по MQL5: Доступ к таймсериям и индикаторам / Организация доступа к данным
  • www.mql5.com
Организация доступа к данным - Доступ к таймсериям и индикаторам - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5