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

 
Alexey Navoykov:

And you can't go to the bottom one. That's why everything is clear.

Only please with the possibility to declare classes-structures beforehand :)

class A;
class B{A*a;};
class A{};
 
fxsaber:

There is less flexibility.

Flexibility is a disruption to the order in which the algorithm is executed? )

Ilya Malev:

Only please with the possibility to declare classes-structures in advance :)

Well, it doesn't contradict logic. Just like a preliminary declaration of a function. If something is declared earlier, it will be initialized earlier, too. Everything is logically connected.

 
Alexey Navoykov:

Is flexibility a violation of the order in which the algorithm is executed? )

Now OnTick can be called from anywhere in the program.

 
fxsaber:

OnTick can now be called from anywhere in the programme.

If you need it, you may declare void OnTick(); at the very beginning in C++. But in general the order of functions declaration is an additional method of code correctness control. For example, if in some plug-in inluder you accidentally have a call OnTick() or, even worse, OnInit(), is it good? Libraries must not see your working code.
 
Alexey Navoykov:

Well, it doesn't contradict logic. Just like a prior declaration of a function. If something is declared earlier, it will be initialized earlier, too. Everything is logically connected.

It may contradict your logic, but it doesn't contradict common logic for a second. Because everything is guaranteed to be initialized by the moment the code's execution starts.

 
Ilya Malev:

This may contradict your logic, but it doesn't contradict conventional logic for a second. Because everything is guaranteed to be initialized by the time the code is executed.

You seem to have misread my post. It says it does NOT contradict)

 
Alexey Navoykov:

You don't seem to have read my post carefully. It said NOT to contradict).

That's right, I apologise, it happens.

 
Alexey Navoykov:
If you need it, you may declare void OnTick(); at the very beginning. But in general the order of declaration of functions is an additional way to control code correctness. For example, if in some plug-in inluder OnTick() or even worse - OnInit() is accidentally called, is it good? Libraries must not see your working code.

What to do when including libraries, each of which includes the same libraries inside itself?

 
fxsaber:

What do I do when I connect libraries that each connect the same library internally?

So what's the problem?
 
fxsaber:

What to do when connecting libraries, each of which connects the same library inside itself?

#ifndef  MQL_TOOLS_H
#define  MQL_TOOLS_H

#endif

it's strange that the directives are entered but not used

Reason: