Features of the mql5 language, subtleties and tricks - page 38
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
Rudiment functions (not needed)
why?
Why?
Everything is done through the appropriate operators.
I don't quite understand, give me an example
I don't quite understand, give me an example
Forum on trading, automated trading systems and trading strategies testing
Peculiarities of mql5 language, tips and tricks
fxsaber, 2017.04.26 15:16
All standard types are set to each otherResult
Ah, that's what you mean )) let them have them now that they have them )) otherwise the code will suddenly stop working as it did with the structures, at least they introduced union and in a sense we can get by with a crutch ))
Rudiment functions (not needed)
What does this function duplicate?
Using union instead of casting structures
Since build 1596 explicit conversion of structures of different types to each other is forbidden. Such an example that works with the old builds will not compile now:
However, in MQL now it is possible to combine data into a union structure. Because of this, it is possible to cast types through a union:
This structure is already available in the new builds.
p.s. Please ask the developers to start fixing the documentation in casting:https://www.mql5.com/ru/docs/basis/types/casting.
Using union instead of casting structures
Forum on trading, automated trading systems and strategy testing
Libraries: TypeToBytes
fxsaber, 2017.04.26 10:49
Random structure casting is availableunion does not allow for casting for structures with custom constructor and/or copy operator.
There was no mention of completely replacing the casting with union.
p.s. I looked at your code:
Arbitrary casting via write/read binary... Lights out. Don't read any further...