Features of the mql5 language, subtleties and tricks - page 150

 
Denis Kirichenko:

There is one. I've only brought up one entry from the log. The full one is like this:

Then I don't understand where the last line is coming from.

 
fxsaber:

Then I don't understand where the last line is coming from.

After selecting "Edit" context menu, the navigator can't find the original mq5 in the same path as ex5.

Because ex5 has been moved to the scripts folder from Shared Projects, where mq5 lives

Fix. Let's make the same smart search as in the tester settings

 
fxsaber:

Thank you, good rule. Became a victim of my own incompetence. Really, need some more rule for such a more obvious case.


Maybe for both cases Warning clever to do?

There must be a compilation error here.
 
Alexey Navoykov:
There must be a compilation error here.
Oh, come on. On what grounds? delete does not change the pointer's value, so there is no constancy violation either. So, I have no complaints to the compiler here, everything is clear.
 
Vladimir Simakov:
Oh, come on. On what grounds? delete does not change the pointer's value, so there is no constancy violation either. So, I have no complaints about the compiler here.
I am talking about the second sample
 
Alexey Navoykov:
We are talking about the second example
void f( const int i )
{
  static const int j = i;
  
  Print(j);
}

void OnStart()
{
  f(1); // 1
  f(2); // 1
}

The static variable is initialised on the first call.
 
fxsaber:

The static variable is initialised on the first call.
Are you sure? I'll have to test it tomorrow. The docs says:Static variables exist at runtime and are initialized once before call of the specializedOnInit()function. If no initial values are specified, static memory class variables take zero initial values.

If you are writing as you do, then the dock writer has a fierce bug.
 
Vladimir Simakov:
...If as you write, then the dock writer has a bad bug.
The doc writer is exactly right. Static variables cannot be initialized with local values.
If this really compiles in Mql, then this bug must have occurred when fixing the order ofinitialization of static variables a year ago.
 
Alexey Navoykov:
The dock writer is exactly right. Static variables cannot be initialized with local values.
If it does compile now in Mql, then it must be a bug from fixing static variable initialization a year ago.
Or the code was converted to C++ standard, and in this case it is a bug in the docs. Now, I'll put my head together, drink coffee and check it.
 

Developers. An explanation is needed. Which to believe? The docs or the implementation? We have undefined behavior so far.

@fxsaber, I don't advise you to use it before the official explanations, in case they take it and fix it.

Reason: