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

 
I think they wanted to filter out the reconnection. I don't remember how it ended.
 
Andrey Khatimlianskii:
It seems that they wanted to filter repeated enable. I don't remember how it ended.

It seems to have always been filtered that way. At least for as long as I can remember. But #ifndef is still safer, because if the same file is included via different paths (symbolic/hard link), ME does not understand that it is the same file.

On the other hand this is also a double-edged sword. If it turns out that the files are really different (different versions), then there could be confusion, no one knows which file is included, so the developers need to fix this, to filter not by symbolic file path, but by real path.

 
Perhaps the question is about libraries and not about inluders?
 
SemenTalonov:

it's strange that directives are put in and not used

Similar use, but it's almost insane to prescribe this for every mqh.

Andrey Khatimlianskii:
It seemed that they wanted to filter out re-enabling. I don't remember how it ended.

Re-insertion is ignored.

TheXpert:
Maybe the question is about libraries and not about inluders?

I've never worked with ex4/5 libraries, so I was referring to inluders.

 
fxsaber:

Re-activation is ignored.

What is the problem with

Forum on trading, automated trading systems and strategy testing

Features of mql5 language, subtleties and tricks

fxsaber, 2019.01.14 17:30

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


?

 
Andrey Khatimlianskii:

What's the problem with that then?

There is nothing wrong with it now, but it was suggested to cancel if I understood correctly.

Forum on trading, automated trading systems & strategy testing

Peculiarities of mql5 language, tips and tricks

Alexey Navoykov, 2019.01.14 15:26

In C++ code is processed by compiler strictly from top to bottom, so everything from top is already initialized. And you can't address to bottom. That's why it's clear. And since the developers have introduced some rules of their own here, let them ensure the correct order of code execution.

 
fxsaber:

It's fine now, but it was suggested that it should be cancelled, if I understand correctly.

What's the connection to the inludes?
 
fxsaber:

There is nothing wrong with that now, but it was suggested that it should be cancelled, if I understood correctly.

No, it was misunderstood.

It was suggested that the preprocessor process the code in order. In this case, the inludes are inserted in the code at the place of the first mentioning in the same way.
 
Andrey Khatimlianskii:

No, you've got it wrong.

The preprocessor was suggested to handle the code in order. At the same time, the inludes are inserted in the code in the place of the first mentioning.

The point is that if the functions you want to use are specified in the inlude, you need to write them according to the suggestion, if the inlude is below.

 
fxsaber:

The point is that if you have specified functions in the inludes that you are going to use, you need to write them according to the suggested order, if the inludes are below.

//gcc 5.4.0

int main(void)
{
    g();
    return 0;
}

void g() {f();}

void f() {}

You said about the order, but forgot about multipass.

and it seems there are a couple of UBs with the order

Reason: