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
You are welcome!
Given that MQL is a strange implementation of "C", like everything MetaQuotes, you will probably never figure out the reason why one gives a warning and the other not. And even if you do, it will probably not make much sense.
It is nice to see the amount of work you are putting into the forum. I would like to say thank you for all your efforts.
I have checked and thought about the differences in this case and I would like to share my assumption about it.
Here is the code, where the warning is showing up:
This leads me to the conclusion, the assemby code produced by the compiler would have a different operation command sequence as version B.
I guess, without a result its a very similar assembly sequence to the conditional oeprator "?" , which in fact is only one command on the cpu to be executed.
While when comparing two values, a different command is used to do so, therefore a result gets copied by a cpu command into a register for later use. Since this register never gets referenced within the following code, it is evaluated as an "abandoned value".
All in all, these micro times to save are nice but maybe a little over the edge, sometimes.
But in highly repetitive workloads, like in loops, these differences add up fast.
EDIT: To me, it does not make sense. It is inconsequent.
best way to describe it is:
All the time you are just using boolean logic it is fine, but you have added in a numerical comparison of the value 1 to that of a function output.
The compiler is now saying this is an expression with an answer and you are not using it so it is warning you of that, like you say it still works in practice because each function is processed subject to the logic.
Thank you for the explanation, as it seems, I did not see this.
I have checked and thought about the differences in this case and I would like to share my assumption about it.
Here is the code, where the warning is showing up:
This leads me to the conclusion, the assemby code produced by the compiler would have a different operation command sequence as version B.
I guess, without a result its a very similar assembly sequence to the conditional oeprator "?" , which in fact is only one command on the cpu to be executed.
While when comparing two values, a different command is used to do so, therefore a result gets copied by a cpu command into a register for later use. Since this register never gets referenced within the following code, it is evaluated as an "abandoned value".
All in all, these micro times to save are nice but maybe a little over the edge, sometimes.
But in highly repetitive workloads, like in loops, these differences add up fast.
EDIT: To me, it does not make sense. It is inconsequent.
Thank you for your analysis. On a whole I consider MetaQuotes’ way of doing things is very disorganised and ad hoc. One only needs to look at the website itself, and the code in the Standard Library, to see how disorganised and illogical it can sometimes be. From that we can infer that the MQL compiler and MetaTrader’s own code is just as disorganised. It is no wonder that this site, MetaTrader and MQL is always riddled with problems and bugs. When one of them gets fixed, another pops up. On a whole, the quality of MetaQuotes code is not that great.
I agree totally and find it interesting, it still works....
Imagine it be open source, I mean the client side terminal and the language. - I am sure, security and quality would get a real boost.
Metaquotes could focus on their server infrastructure and let the crowd use the api of the servers.
Metaquotes could focus on their server infrastructure and let the crowd use the api of the servers.
Unfortunately, they don't understand that way of thinking. I know of someone who recently started doing an open-source interface for the web-terminal and they hit him with a "cease and desist" legal process on GitHub and got his main project closed which did not even have to do with them. They were very forceful and vindictive for something that was actually beneficial for them, but they simply decided that they would not allow it.
How is that beneficial ?
They want to have control on client software, seems perfectly normal to me. It's a financial product, can you imagine what would happen if their server is flooded with bad requests or attacked like a website ?
I am sorry to say this, but that is untrue.
Go through and test yourself.
The code will conditionally break out into the subfunctions without disturbing the current flow of the function where this code is inserted. - No conditional break within the code flow of the function, if not necessary.
Thats the point of this code, it is valid, it works and it is about 10 times faster than an if-statement. - But thats not the point of discussion here. Its about this code giving a warning, while following does not:
Now tell me, how do you explain that??
I don't see the difference either. The compiler should optimize the expression.
I don't get your point about "10 times faster". What exactly is 10 times faster than what...exactly ?
They could easily keep some things closed-source for security reasons (e.g. protocol) and others things could be partially open-source (e.g. language development).
I'm sure that if language development were partly open-source, many bugs would get fixed quickly, and new ideas would be developed.
They could easily keep some things closed-source for security reasons (e.g. protocol) and others things could be partially open-source (e.g. language development).
I'm sure that if language development were partly open-source, many bugs would get fixed quickly, and new ideas would be developed.
For sure, it would be nice, but it will never happen.