Errors, bugs, questions - page 2416

 
Andrey Pogoreltsev:

There is no need for unambiguity here. It should simply be the order in which the overloaded methods are applied. I.e. the task of the overloading solution is not to create a dilemma, but to choose the best suitable method. If we ignore the access modifier, the first method from the table is taken or it depends on the compiler implementation, but there is no ambiguity.

Here's what if there were 2 methods with different input parameters for example:

Going back to C++, the same vector has one:

So this is an absolutely normal situation.

You gave some very simple example of primary schools. It seems it has nothing to do with the original example.


Alexey Navoykov:

In this example it's a method of a non-constant object, so it must be called, all other things being equal.

Wasn't aware of this rule, thanks.

If we remove the casting and make the argument of the int type for both methods, the code will compile normally. So, it's the casting that causes the MQL hang-up. This casting must not affect the code since it is identical.

It seems that the cause of the problem is that the compiler doesn't check if the casting for the overloaded methods is identical.

 

In general, to solve this problem (and many others in MQL) you need to move one of the methods to an auxiliary class:

class A { };

class _B
{
 protected: 
  A _a[];
 public:        
  const A * operator[](uint i) const { return &_a[i]; }  
};

class B : public _B
{
 public: 
  A * operator[](uint i)       { return &_a[i]; }
};
 
fxsaber:

You have given some very simple example of a primary school. It doesn't seem to have anything to do with the original example.

You should read the C++ standard to see that it's all solved by the same rule I quoted above.
 
Slava:

To start with, in the optimisation cache, both MT5 and MT4 always truncated the string parameters to 63 characters.

When transmitting events, the string cannot be longer than 63 characters either

So what comes from outside is limited

As far as end-user products are concerned. The vendor has to consider the limitations. And if he doesn't know them, he hasn't tested his product enough before selling it

It's not about how it was and is, but how it should be, if you want to keep up with the times and change for the better.

 

I ran into this problem, when testing an EA, after setting the parameters and pressing the start button, the EA settings are reset to default, what could be the problem?

In the video an example

 
Dmitry Melnichenko:

I ran into this problem, when testing an EA, after setting the parameters and pressing the start button, the EA settings are reset to default, what could be the problem?

video example

MT5 resets itself to defaults in the tester after you go to "Settings" tab

See post #1.

 

I asked a question in a neighbouring thread, but not many people seem to look there. I'll duplicate it here:

https://www.mql5.com/ru/forum/6343/page1020#comment_11112212

Briefly: on futures (in the tester) trades are opened and closed (by SL/TP), but always with zero profit. Can it be a bug in the tester? Or some kind of trick is needed?

Вопросы от начинающих MQL5 MT5 MetaTrader 5
Вопросы от начинающих MQL5 MT5 MetaTrader 5
  • 2019.03.26
  • www.mql5.com
Подскажите пожалуйста, такой показатель тестера в жизни реален? И хороший это или плохой результат за год с депо 3000...
 

Compiler bug. When compiling (syntax check) a .mqh file with this code, no error is shown. It is only shown when compiling the executable, which is inconvenient.

class A
{
 public: 
  A(int) {  }
};

class B : public A { };  // Здесь должна быть ошибка  'A' - wrong parameters count

B b;
 
Alexey Navoykov:

Compiler bug. When compiling (syntax check) a .mqh file with such code, the error is not generated. It is generated only when compiling the executable file, which is inconvenient.

Because a heder doesn't compile in principle :)))

If you force the whole compiler to compile a heder, you will get a lot of false positives.

PS. The C++ compiler doesn't complain without using such classes either.
 
Andrey Pogoreltsev:

Because a heder doesn't compile in principle :)))

If you force an entire compiler to compile a heder, you will get a lot of false positives.

PS. The C++ compiler won't complain without using such classes either.

I'm aware that it doesn't compile. I'm talking about syntax checking (which in ME is also called "Compile"), because I even specified it in brackets in a previous post. If you run syntax checking in the C++ compiler too (via the command line usually), it will scold like a darling.