Features of the mql5 language, subtleties and tricks - page 118
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
By the way, about zero, FastLog2 doesn't check for zero, which gives it a head start. But it's still 1.5-2 times slower than log2 if tested correctly).
And what is incorrect about it?
Because even your version of the test produces:
By the way, about zero, FastLog2 doesn't check for zero, which gives it a head start. But it's still 1.5-2 times slower than log2, if tested correctly).
Of course, we should remove zero check from log2 or add the same one to FastLog2.
The question is really about the speed of the computational part. In log2, everything is calculated purely by shifts and additions. FastLog2 uses table values after clever conversions involving multiplication. This code is very old, it was used back in the days of math coprocessors, the situation may well have changed since then.
This is standard MQL5 behaviour: static variables come after global variables.
You can get very seriously messed up because of this.This is the standard behavior of MQL5: static variables start after global variables.
Is that why every static variable of a class/structure has to be declared after the structure itself? And even without assigning any value to it... Maybe we should suggest that the compiler does all this automatically?
This is essentially a bug, an incorrect sequence of program code execution. The compiler should not allow this in principle. You should yell at the developers more often about this.
In C++ code is processed by the compiler strictly from top to bottom, so everything from above is already initialized. And you cannot access the code below. That's why everything is clear. And since the developers introduced their own rules here, let them provide the correct order of code execution.
In C++, code is processed by the compiler strictly from top to bottom, so anything on top is already initialized. And you can't access the bottom one. That's why everything is clear.
There is less flexibility.