harryma23:
To the maintainer of MQL5: Why doesn't this type of code trigger a compiler error?
To the maintainer of MQL5: Why doesn't this type of code trigger a compiler error?
Because you don't call that method anywhere.
(I'm not a "maintainer of MQL5", whatever that means)
harryma23:
Because your method isn't called, so the compiler skip it.
I have something like this, which works as usual:
However, if I have something like this, I would expect the compiler to return an error because no toString() method is defined (and the structure does not allow virtual methods):
To the maintainer of MQL5: Why doesn't this type of code trigger no compiler error? It would be better if the compiler threw an error, because without an error, there's a risk of forgetting to implement a struct method (which would then lead to a runtime error).
Such code
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
I have something like this, which works as usual:
However, if I have something like this, I would expect the compiler to return an error because no toString() method is defined (and the structure does not allow virtual methods):
To the maintainer of MQL5: Why doesn't this type of code trigger no compiler error? It would be better if the compiler threw an error, because without an error, there's a risk of forgetting to implement a struct method (which would then lead to a runtime error).
Such code