Errors, bugs, questions - page 2891

 
A100:

This may be when the compiler objectively has no information:

i.e. f() may have initialized i or may not. And in this case the C++ compiler gives a warning, but the MQL one does not.

In C++ the addresses of memory cells are not hidden, that's why the variable is initialized with rubbish.
In Mql the addresses of memory cells are hidden and are not accessible. This is how the Mql developer messed up the compiler ))

In short, always initialise the variables and you won't get a headache.
 
Roman:

Yes, but before the first iteration the j variable is not initialized yet, which is what the compiler swears at.

If you don't use this variable or put the assignment i=j down in the loop body, which would be identical to the execution of the first option, there will be no warnings. The compiler doesn't check the logic of the loop and the execution sequence, it checks the syntax from top to bottom, I think so, I don't know for sure)

 
There is an error in the site search service. This search does not produce this result.
 

fxsaber:

And in other situations.

hitting reply instead is rocking the terminal - a great innovation

 
Compilation error:
#define  MACRO(X)\ //Error: '\' - unexpected in macro definition
              X
 
TheXpert:

you press reply instead, you download the terminal - a great innovation.

It's all the same thing... And with the question for which I almost got nailed here (in the same drop-down menu wallet and unread topics - just twin brothers), and with yours, and yet (I do not know how anyone) I hang such ... "thing."

That's what to do with this inscription? Nowhere any link to view who is asked and why, no (perhaps it lies in the wallet, but I did not look there).

The very persistent impression is that all these "wonderful" changes to the site are being made by one person.... And personally for himself. Exactly the way he thinks he needs it for himself. And he doesn't give a damn about our opinion...

 
Сергей Таболин:

That's what to do with this inscription?

I don't know, when there are normal applications it disappears.
 

WhenREASON_ACCOUNT is changed, it was expected to receive the previous account and terminate work with it, logically, but no, if the account has changed, we receive a new number in the deinit at REASON_ACCOUNT.

Logically, the program should finish working with the current data and send the new data when making a new call and not change the data in the process...

 
Vladimir Pastushak:

WhenREASON_ACCOUNT is changed, it was expected to receive the previous account and terminate work with it, logically, but no, if the account has changed, we receive a new number in the deinit at REASON_ACCOUNT.

The program should logically complete work with the current data and pass the new data when making a new call, without changing the data in the process...

Here is code demonstrating incorrect behavior

//+------------------------------------------------------------------+
//|                                                         Test.mq5 |
//|                        Copyright 2020, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   Print("Start ", (string)AccountInfoInteger(ACCOUNT_LOGIN));
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   if(reason == REASON_ACCOUNT)
      Print("Stop ", (string)AccountInfoInteger(ACCOUNT_LOGIN));
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---

  }
//+------------------------------------------------------------------+

Result

2020.10.28 17:23:05.725 Test (EURUSD,M1)        Stop 600....
2020.10.28 17:23:06.306 Test (EURUSD,M1)        Start 600....
2020.10.28 17:23:17.478 Test (EURUSD,M1)        Stop 535....
2020.10.28 17:23:18.156 Test (EURUSD,M1)        Start 535....
 
Vladimir Pastushak:

WhenREASON_ACCOUNT is changed, it was expected to receive the previous account and terminate work with it, logically, but no, if the account has changed, we receive a new number in the deinit at REASON_ACCOUNT.

The program should logically finish working with the current data and send the new data when making a new call, and not change the data in the process...

This is not an error and therefore the behaviour will not change. Just consider this peculiarity.