Let's go SetLastError!!! - page 3

 
VladislavVG:
And look where I wrote about error handling - there are forum threads ;)

I didn't get the right advice from you here for some reason :) What are you talking about? In MQL5 they did it properly in MQL4, you can fix it with an includes, that's all :)
 
vit46:

I didn't get the right advice from you here for some reason :) What are you talking about? MQL5 has done it properly in MQL4, you can fix it with an includes, that's all :)

If you mean this post :

 
vit46:
Очень нехвотает этой функции в MT4 что делать помогите!

Функция GetLastError() обнуляется после чтения ее значения. Вставьте дополнительное пустое считывание перед нужной Вам операцией.

int err=GetLastError();
OrderSend(...);

if (GetError()==конкретный номер){
         // код обработки сброс ошибки или наоборот
         SetError(0);
         }
else if(...)

I wouldn't do it that way : IMHO it's wrong, or rather not quite right. The others more or less confirm what I advised you ;) .....

 
VladislavVG:

If you mean this post :

I wouldn't do it that way : IMHO - it's wrong, or rather not quite right.

Develop the topic.
 
Roger:
Develop the topic.

What is there to develop?

Mistakes should be dealt with as they arise, not put off "for later".

 

It's already written on page two.

use it.

int ticket=OrderSend();
if (ticket<0) // и только после этого
{  GetLastError()  }
 
VladislavVG:

If you mean this post :

I wouldn't do it that way : IMHO it's wrong, or rather not quite right. The others more or less confirm what I advised you ;) .....


That's not true, it's better. More advanced languages are designed that way in terms of error handling... so MQL5 is slowly but surely getting better....
 
Что тут развивать?

Ошибки надо обрабатывать по мере их возникновения, а не откладывать "а потом".

That's clear. I never do that myself, I offered it as a solution to the problem. But I would like to hear why you can not do so in principle. Maybe in the future I will come across, and then it will be useful.

 
sergeev:


It's already written on page two.

use it.


This is not good because if you had an error from a previous operation and did not process it, then if there is no error in the present operation, you will process the previous one.
 
vit46:

this is not true but better. more developed languages are designed that way in terms of error handling... so MQL5 is slowly but surely getting better....

You still haven't written what your suggestion helps to improve MQL.
 
sergeev:


It's already written on page two.

use it.


Yes, this is true and it is consistent with my approach... The unconditional GetLastError call cannot be used in other words.

Reason: