Errors, bugs, questions - page 1991
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
Add a default constructor to the structure.
Forum on trading, automated trading systems and trading strategy testing
Bugs, bugs, questions
fxsaber, 2017.09.06 09:38
Inattentive me:) Can you explain why this is needed? Why can't the constructor be used?
Or is it to show an error of structure initialization with a closed field?
Inattentive me:) Can you explain why this is needed? Why can't the constructor be used?
Because when writing my own code I came across a situation where my structure is involved in a union. The solution with an empty constructor came immediately to mind but it was a bummer that my code had a union. That's why I was asking this question not for the sake of boring me but for practical use.
I had to write this twist to avoid this "bug" (is it a bug or not?).
I haven't seen any other solution yet.
Run it, saw the problem. It seems that only structures with public fields are allowed with unions now. Then it would be possible to write struct = {0};
This is not the case.
This is not the case.
Maybe I misunderstood you again, but this code works without any warnings:
Maybe I misunderstood you again, but this code works without any warnings:
That's right, the public structures are initialized. But union has nothing to do with it.
Interestingly, if a structure with a hidden field is made a public field of a new structure, then the new one will not initialize either, even if all fields are open.
Hi, could you tell me if it's possible to declare an array by specifying the number of elements in it with a variable? If not, how can this be done?
Hi, could you tell me if it's possible to declare an array by specifying the number of elements in it with a variable? If not, how can this be done?
https://www.mql5.com/ru/docs/array/arrayresize
Hi, could you tell me if it's possible to declare an array by specifying the number of elements in it with a variable? If not, how can this be done?
ArrayResize()