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
OK. I don't understand. Do you understand? Are you sure you understand? Exactly?
The argument boils down to the following statement:
...
That was not about a general argument, but about a situation concerning a single post, and I explained what the problem was. Okay, there was no catastrophe.
Declared array double x[268435448];
The same array in OnStart() function.
Also made a recursive call with LONG_MAX depth.
No problems.
Don't use static arrays?
large. if the size of the array is small, constant and known in advance, static is better and probably faster.
large. if the size of the array is small, constant and known in advance, static is better and probably faster.
I would like to have a way to get a list of static variables/arrays and their sizes. Probably need a code parser like done here.
I guess static string array and double array are quite different things.
I guess static string-array and double-array are quite different things.
string is essentially an internal class consisting of a pointer and int size, i.e. for double array will occupy conditionally 1.5 times less space
I don't think that there's much sense to bother with it, unless you have static arrays with millions of elements.
Not to use static arrays?
So there are essentially four types of data in MQL:
If we leave the stack to functions and their local variables, we are left with three types to work with. I personally believe (and this is just my opinion) that data defined with automatic lifetime combines well the advantages of the previous two types, without their disadvantages. Data defined with automatic pointer is as well predictable and safe as static, yet just as flexible as dynamic, manually controlled data. By predictability I mean in scenarios where there's no need to do additional pointer bit checks and wonder if someone else has already deleted the data before. By flexibility I mean scenarios where one can work with data referenced by an auto-pointer like with a regular pointer, by passing the pointer to a function, or, for arrays, by recycling it.
To illustrate what I've just said, you can compare the initial code provided by Ihor Herasko and the same code I've written for POINTER_AUTOMATIC. There are no extra checks and initializations, no operator delete 60 000 000 times. All this saves you time, effort and, what's also important, resources. If you understand it, you almost never need to work with pointers. You can always write such an algorithm that would either minimize this work or stay at all. For example, I never handle objects manually in my code - there's just no need in that somehow. As for static arrays, then sometimes I have to use, for example, to sew into the program the data it needs, but it's so special things, that ordinary users, I assume, don't need them. It is best to use ready-made collections such as CArrayObj, or your own. Now templates and MQL capabilities allow you to create quite flexible things that are much better than static arrays.
Vasiliy Sokolov #:
Static, predefined data. Stitched into the program at compile time and no longer modified. They are stored in some private memory area. For instance, these are static arrays like char[1024].
If the array is not initialized,
why should it be written into EX5?
If the array is not initialised,
why should it be stitched into EX5?
Yes, that's right, uninitialized ones are not sewn in, of course. The initialized ones do. But the sizes of both types are defined at compilation time and don't change anymore. That is, static arrays may be conditionally divided into two groups.
There is no rubbish collector in emcool.
Officially, yes. Unofficially, many things indicate that it does exist: