Errors, bugs, questions - page 1034
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
As a matter of fact, it makes sense, because what is written looks a bit delusional.
C++ doesn't consider that way.
Yeah, C++ doesn't count a lot of things, but the point is that the initialisation of static members is probably not in the order in which they are initialised, but in the order in which they are declared.
I'll have to read the standard on this subject.
https://www.mql5.com/ru/docs/basis/variables/initialization
I made it too easy - I didn't move const - as you can see now everything is clear - one constant is initialized by another one:
The compiler indicates as an error that the s1 member is protected. If we replace protected with public, everything works like clockwork. But being protected has nothing to do with the initialization order or assignment order, nor with the possibility of initialization with a particular value
I'll have to read the standard on this.
I agree, in general the compiler is not the same as the compiler and you have to sort it out.
Here is another example
The MQL compiler here does not want to initialize the array with the const int value (enum - passes)
Again I'm appealing to the fact that C++ copies it and initializes correctly.
Probably an error in the call sequence
In C++, the order of evaluating the operands of an expression is UB. Why are you relying on a specific order here?
was output as "word Hello" ?
This is what happens in this case for an overloaded operator for the int type, while for the string type everything is output normally.
Moreover, it has nothing to do with C++. Suppose you wrote in your code
And you have these functions executed in reverse order or at all for different types of arguments - in any orderGreetings!
Help me fix 'invalid pointer access'.
In OnInit() we have:
SymbolsCollection = new CSymbolsCollection(); SymbolsCollection.RefreshRealSymbols();
CSymbolsCollection::RefreshRealSymbols() method has aCleanSymbolsArray(myRealSymbols) call;
These method and variable are declared in the class as:
The problem is thatRefreshRealSymbols() executes normally if called in theCSymbolsCollection constructor.
However, calling SymbolsCollection.RefreshRealSymbols(); in OnInit(); results in:
The error points to the CleanSymbolsArray(myRealSymbols); line in the body of the CSymbolsCollection::RefreshRealSymbols() method, the position is right after the opening bracket.
Any ideas?
...
Any ideas?