Features of the mql5 language, subtleties and tricks - page 121
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I don't understand it then.
Forum on trading, automated trading systems and trading strategies testing
Peculiarities of mql5, tips and tricks
Alexey Navoykov, 2019.01.14 16:35
If you need it, you may declare void OnTick(); at the very beginning. But in general, the order of functions declaration is an additional way to control code correctness. For example, if in some plug-in call OnTick() or, even worse, OnInit() happens, is it good? Libraries must not see your working code.Then I don't understand it
The forward declarations are only for classes and structures, not for functions.
The point is that if the functions you are going to use are specified in the inlude, you need to write them according to the suggestion, if the inlude is below.
What's the problem with inserting an inluder earlier?
It may be inconvenient for one file (function with body must be before call), but if the function in mqh - what is the problem to insert the inlude at the beginning?
The forward declaration is only for classes and structures, not for functions.
That's great that you clarified it.
What's the problem with inserting an inluder earlier?
It might be inconvenient for a single file (a function with a body necessarily before the call), but if the function is in mqh - what's the problem with inserting an inline at the beginning?
Some constructs with macros have sometimes required an inlude on the last line. I won't give you a specific example, I've encountered them in practice many times.
The forward declarations are only for classes and structures, not for functions.
Some constructs with macros sometimes required an inlude on the last line. I won't give you a concrete example, I've encountered them many times in practice.
Well, this is something quite exotic. I don't think single macros are worth sacrificing architectural correctness for their sake.
Anyway, the program code must in any case be executed exactly according to its intended algorithm. Access to a variable before its initialization is nonsense. This shouldn't compile.
By the way, if an inlude uses some functions that are not there, they must be declared there anyway. Just like classes and extern variables. Otherwise, it's a crutch, not an inlude.
Correspondingly, the plug-in should not depend on the place where it is plugged.
By the way, if some functions are used in the inlude, which are not there, they must be declared there anyway. As well as classes and extern variables. Otherwise it's not an inlude, but a crutch.
What do you think an inlude is? To me, it's just a piece of text, allocated to a separate file. And its re-introduction into the source is ignored. Nothing else.
What do you think an inlude is? To me, it's just a piece of text, allocated to a separate file. And its re-introduction into the source is ignored. Nothing else.
I think it should be independent and independent code. It makes more sense, and it's easy to control, and do independent syntax checks on this code. But if everything is in different files and it's not clear where it's being called from, it's chaos.
Well, I think it should be independent independent code. It makes more sense and is easier to control and perform independent syntax check of this code. And if everything is scattered through the files and it is not clear what is called from where - it's chaos.
Examples of my code have been posted. I haven't heard any feedback about chaos, even for incudes that don't compile.