Errors, bugs, questions - page 2461
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
Could you elaborate on this point?
Below is my subjective opinion, if I'm wrong somewhere, I'd be happy to help.
StringLen used to work O(n) until the first NULL character (0x0000) in the string, now it works O(1).
String length could always be truncated via StringSetCharacter(str, pos, 0x00), but they introduced StringSetLength for some reason.
Most likely, the task of code acceleration when working with strings was solved.
The task of speeding up the code was solved and nobody cares that half of the function now handles NULL characters in string and the other half does not.
The result:
Below is my subjective opinion, if I'm wrong somewhere, I'd be happy to help.
StringLen used to work O(n) until the first NULL character (0x0000) in the string but now it works O(1).
String length could always be truncated via StringSetCharacter(str, pos, 0x00), but they introduced StringSetLength for some reason.
Most likely, the analyzer solved the task of code acceleration when working with strings.
The task of speeding up the code was solved and nobody cares that half of the function now handles NULL characters in string and the other half does not.
The result:
StringLen used to work O(n) until the first NULL character (0x0000) in the string, now it works O(1)
To the developers:
Please add the ability to specify forced code generation for the default assignment operator (copy constructor):
It's a bit complicated. It is easier to use the default constructor analogy:
1) any assignment operator overrides the default assignment operator
2) any copy operator overrides the default copy operator
Just partially corrected mistakes ... why not!?
Because MQL has no consistent idea when dealing with strings with NULL characters this is the problem.
For instance, StringToShortArray supports NULL characters in a string while the inverse function ShortArrayToString does not...
As a result, more time is spent on catching bugs and searching for workarounds rather than on solving particular tasks.
It's a bit complicated. It is easier to use the default constructor analogy:
1) any assignment operator overrides the default assignment operator
2) any copy operator cancels the default copy operator
I don't need undo; I need a forced generation on the contrary.
MQL has no functionality for deep copy of complex types, and in assignment operator and copy constructor they are implemented by default.
Since there is no consistent idea in MQL when dealing with strings with NULL characters, this is the problem.
For example, StringToShortArray supports NULL characters in a string, while its inverse function ShortArrayToString does not...
On the one hand yes, on the other hand it is explicitly stated in the Documentation: "or until terminal 0 is met".
On the one hand yes, on the other hand it is explicitly stated in the Documentation(that it does not)
AndStringToShortArray says the same thing:
However, this does not prevent it from adequately handling NULL characters in the string.