
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 write this way because I like it. That said, it gets really bad when debugging.
Even in this expression.
it's hard to figure out who returned what. In more complex ones (I practice it all the time) it's really hard.
If you want to use 2-3... let's assume 5 results of functions execution united by logical operations (or conditional ternary operator) - I've seen it on githab or somewhere else, this code can be handled
But if you have a dozen of these "goodies"... imho, it's not practical
I'm not a mql developer, of course,
but in C switch generates quite efficient binary search and does not cause unnecessary page paging or cache dumping. So yes, it's often better than indirect addressing via arrays and structures.
the developers wrote somewhere and here similar information
found only this:
Forum on trading, automated trading systems and strategy testing
This is the article we've found in MQL5.
Slava, 2011.04.14 09:59
No, unfortunately it will not. For string types only if ... else if ... else
Using integer types in switch speeds up the analyzer's code several times as much as if
But if it's a dozen or so... imho, it's not practical.
Small monster.
Logical operations allow you to write succinctly when using different settings via macros. But it's a horror, of course.
logical operations allow for concise writing when using various settings via macros. But it's a horror, of course.
Your example from "the end justifies the means"
my question was about a very different and incomprehensible style
The little monster.
You can't look a gift horse in the mouth. But here are a couple more examples of other people's code, which gave me a few unforgettable dozens of minutes of debugging. Perhaps someone will recognise their own code.
I don't know if it was easy to write it that way but it's unreal to debug it, all the more to read it. And I don't see any objective reasons for writing it that way.
And I don't see any objective reasons for writing it that way.
They are subjective, of course. I don't like unnecessary variables and multiple returns. For some reason, I believe that EX5 will be shorter and executed faster without them.
They are subjective, of course. I don't like unnecessary variables and multiple returns. For some reason I believe that EX5 will be shorter and faster without them.
By the way, this confidence that the code will be shorter and faster is not justified.
here it is
and this
return A()||B()||X();
I'm sure it will be the same in speed (and maybe in size of code and memory used).
It's just the second variant is faster to write and everybody writes it and then, when it is necessary to add/complicate something, they leave the second variant but bloated to a difficult-to-read one.
You should periodically perform refactoring in this respect and you won't have troubles.
Do refactoring periodically in this respect and there will be no problem.
Only for those who have a lot of free time or are objectively so pressed that there is nowhere to go without it.
When there is a lot of return, the code will 100% be different.Only for those who have a lot of free time or are objectively so pressed that there is nowhere to go without it.
ZS When there is a lot of return, the code will 100% be different.I understand, but partly agree, I just think everyone has experienced relatively long bugfixing times, which would be found faster if the code was "perfectly ready" for debugging.
It's unclear what eats up more time - longer writing "usable" code or debugging and finding bugs, it's always different I guess.
When there's a lot of return, the code will be 100% different.
C++ VS2019 under debugger
source code:
asm debugger
reduced by commands one call just in 2 columns not to count:
as you can see here and the commands almost repeat each other, it's clear that in the first test you need to add some more return
with 99% confidence, I think that at the processor level these codes will run at the same speed up to a clock - in the processor optimization, paralleling and who knows what else works at the level of micro-commands