Errors, bugs, questions - page 2209
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
And because your examples are purely theoretical. They are purely for students. No programmer in his/her right mind would put such things into production.
Postfix and prefix increments and decrements are actually used first of all in loops. And they are called increments and decrements!
Here are some examples
и
If you claim that prefix and postfix operations work alike, then flag in the hand and drum on your neck.
In the case of prefix increment, you will get an uninitialized null array element and an array out of range error at the last iteration.
Maybe your high mind doesn't get it, I'll repeat my question once again.
Is the highlighted one hard for you to see?
Now to the point, why in the example that appears in the conversation, the result in mql == 12 and it doesn't matter whether it was made out of hand or not, when there is a difference in postfix and prefix operations, the result should be == 13
ps. and i'm not making a statement, because now i checked and really do postfix and prefix now have a difference, but my question above gives reason to believe that the ambiguities in the language at compile time apparently enough and before you pounce on someone in the branch, deal with these UB, we are not at fault here
By the way, I see the help has already been tinkered with )).
Maybe your high mind doesn't get it, I'll repeat my question again.
you don't understand the highlighted part?
now to the point, why in the example that appears in the conversation, the result in mql == 12 and it doesn't matter whether it's made out of hand or not, when the difference in postfix and prefix operations, the result should be == 13
ps. and i'm not making a statement, because now i checked and really do postfix and prefix now have a difference, but my question above gives reason to believe that the ambiguities in the language at compile time apparently enough and before you pounce on someone in the branch, deal with these UB, we are not at fault here
By the way, the help looks like it's been shoveled around).
Don't be snarky.
Who says the results have to be 13? Again, results with side-effects are highly dependent on optimization. Even if you don't apply optimization to such an expression, an implementation comes into play - a change in the variable's value either immediately after using it or after calculating the expression. Which implementation is correct?
We're not going to deal with UB, that's undefined, and clearly wrote: "Do not do that.
Where has the help been copied? I have opened MQL5 reference from MetaEditor build 1755 dated January 18. It says the same thing
Important Notice
int i=5;
int k = i++ + ++i;
Computational problems may occur while moving the above expression from one programming environment to another one (for example, from Borland C++ to MQL5). In general, the order of computations depends on the compiler implementation. In practice, there are two ways to implement the post-decrement:
Currently the first way of post-decrement calculation is implemented in MQL5. But even knowing this peculiarity, it is not recommended to experiment with its use.
Your original statement was that there is no difference between postfix and prefix operations. Isn't there?
Don't be flippant.
Who says the results have to be 13? Again, results with side-effects are highly dependent on optimization. Even if you don't apply optimization to such an expression, an implementation comes into play - a change in the variable's value either right after you use it or after calculating the expression. Which implementation is correct?
We are not going to deal with UB, that's why it is undefined, and we explicitly said "don't do that".
Where did you go in the reference? I have opened MQL5 reference from MetaEditor build 1755 dated January 18. It says the same thing
Important Notice
int i=5;
int k = i++ + ++i;
Computational problems may occur while moving the above expression from one programming environment to another one (for example, from Borland C++ to MQL5). In general, the order of computations depends on the compiler implementation. In practice, there are two ways to implement the post-decrement:
Currently the first way of post-decrement calculation is implemented in MQL5. But even knowing this peculiarity, it is not recommended to experiment with its use.
Your original statement was that there is no difference between postfix and prefix operations. Isn't it so?
I'm not being cheeky, note where you started the dialogue, i.e. I had to execute a code i didn't even know about - super
as for the help - yes, it was overhauled because when I was dealing (about two years ago) with postfix and prefix operations in mql, I obviously do not remember this material now
so, the subject was closed, and we introduced this difference and did it well, but you have to warn that you're changing
Please advise on partial position closing, account type RETAIL_HEDGING. For example, I close half of a position in Expert Advisor and a new order with a smaller lot should open automatically. So, at what point the new order is guaranteed to be in the terminal? Do I understand correctly that it does not have to appear immediately after the PositionClosePartial and we have to catch it somewhere in OnTrade?
What the hell is that thing?
\on the help - yes, it has been heavily rehashed, because when I was dealing (about two years ago) with postfix and prefix operations in mql, I obviously do not remember this material now
in general, the topic was closed, and we introduced this difference and did it well, but you have to warn them about the changes, don't you?
For the sake of interest I decided to check on the old 1159 build from June 2015. Its help has everything that Slava quoted. So maybe you got something mixed up.
What the hell is that thing?
It's a crash:) Go to servicedesk!
It's a crash:) Go to servicedesk!
Got it - broke the bank :)
I see - broke the bank :)
It happens)
It happens)
I don't know how to localise this error? I just don't want to give away the whole script, and I don't want to re-pack everything....