Errors, bugs, questions - page 2670

 

Tester error (or maybe I don't understand it anymore)

Profit trade missing in the tester

 

Another encounter with the previously described bug- "Undefined Behavior, you create a complex wrapped object with internal type "C" several times, but it turns out to be a completely different data type, maybe "B", maybe "int", whatever you want...".
In fact it took a day to localize, reproduce and find workarounds, unfortunately all to no avail...
Previously suggested workaround using fictitious template parameter, for the example below turned out to be useless.

template<typename _Tp, typename _Opt>
struct It_g{
   class Opt : public _Opt{}; 
   _Tp p;
};

template<typename _Tp>
class A_g{
public:
   struct It : public It_g<_Tp, Opt_g<_Tp>>{};
};

template<typename _Tp>
class V{
public:
   struct It : public  A_g<_Tp>::It{};
   It b;
};

template<typename _Tp>
class Opt_g{
   template<typename _It>
   static void test(_It &it){      
      printf(typename(_Tp));          // int
      printf(typename(it.p));         // ClassA*
      
      _Tp p = it.p;                   // Compiler Error: '=' - illegal operation use
   };
};


template<typename T>
class GetStructType{
public:
   struct type : public T{};
};

template<typename _It>
void test(_It &it){
   GetStructType<_It>::type::Opt::test(it);
}

class ClassA{};


void OnStart(){ 
   V<int> v1;
   test(v1.b);
   
   V<ClassA*> v2;
   test(v2.b);
   
   V<int>::It it3;
   test(it3);
   
   V<ClassA*>::It it4;
   test(it4);
}

The only workable solution I managed to get using the "homemade" auto type, but I got huge compilation costs with zero profit in the speed of the real code...
Please help, maybe someone has an idea how to work around it.

 
Alexey Klenov:

Tester error (or maybe I don't understand it anymore)

The visualiser, for architectural reasons, does not always show the current status.

 
fxsaber:

The visualiser, for architectural reasons, does not always show the actual condition.

Thank you, I will keep that in mind.
 

Defects in template function/class cache:
(not fixed by MT5(build 2361)) *** (up) Undefined Behavior, you create a complex wrapped object with internal type "C" several times and it turns out to be quite a different data type, maybe "B", maybe "int", whatever you want...
(not fixed by MT5(build 2361)) * Compile Error, bug on passing a function pointer as a const ref template argument.
(not fixed by MT5(build 2361)) * Compile Error, B<int> object can be created after B<void*> class object, but compile error occurs if done before.


Defects in template function/class work:
(not fixed by MT5(build 2361)) *** (up) Compile Error, bug inside template function, passed pointer withinexplicit type conversion operation behaves like a class otherwise.
(not fixed by MT5(build 2361)) ** Compile Error, bug with template class code generation while using internal class.
(not fixed in MT5(build 2361)) ** Compile Error, bug on attempt to access internal class for template parameter of template function.
(not fixed by MT5(build 2361)) ** Compile Error, bug on generation of template method/class, the process of "auto-replacement" of template parameter goes outside the scop into the main program code.
(not fixed by MT5(build 2361)) * Compile Error, bug with lack of autogenerating template class code when template class acts as return value for template method.
(not fixed by MT5(build 2361)) * Compile Error, bug when internal struct is passed to template function, the resultingdata type cannot be used as a base data type for another internal struct in the template class.
(not fixed by MT5(build 2361)) * Compile Error, bug on calling a template function with explicit argument types when called from an overloaded non-template function.

(not fixed by MT5(build 2361)) Compile Error, bug on internal class definition - no reference to global namespace when specifying a base class.
(not fixed
by MT5(build 2361)) *** (new) Compile Error, the main claim to the inappropriate output warning - "deprecated behavior, hidden method calling will be disabled in a future MQL compiler version".The current implementation is firing a cannon over a sparrow.
(
not fixed by MT5(build 2361)) ** (new) Compile Error, the bug concerns the return value of a template function when the return value is an internal class inside a template class whose parameter type is defined by the argument type of the template function.
(
not fixed by MT5(build 2361)) * (new)Compile Error, no check for reused template type names is performed when declaring a template function inside a template class, which leads to unexpected behavior.
(
not fixed by MT5(build 2361)) * (new) Runtimer Error, in base class constructor it is impossible to perform explicit typecast on casting pointer to object of base class to pointer to parent class.
(
not fixed by MT5(build 2361)) (new) Compile Error, multiple defects related to return "in place created" object when template class/structure is the object.


Defects related to call priority mismatch for overloaded functions in MQL vs C++:
(not fixed by MT5(build 2361)) *** When there is inheritance of classes A <= B <= C <= D and two overloading functions are implemented, for example, one with parameter A* and the second with parameter B*, then passing in such function an object C* or D* in MQL causes a compilation error "ambiguous call to overloaded function".
(not fixed by MT5(build 2361)) ** Runtime, Priority mismatch for calls of overloaded template functions.
(not fixed by MT5(build 2361)) ** Compile Error, the priority of calls of overloaded template functions actually depends on the type of template parameter, which in theory should not affect the result of compilation.
(not fixed by MT5(build 2361)) ** Compile Error occurs at generation of the code of the template function in spite of the fact that there is an overloaded template function with the suitable signature for the passed parameters.


Defects related to the slow execution of functions, code optimizer work:
(not fixed by MT5(build 2361)) ** (new) Runtime, large overhead when adding one element at a time into an array using ArrayResize, despite the fact that the memory for them has been reserved in advance, for example, structures are up to 7 times slower.


Suggestions:
link- about allowing literals and temporary variables to be passed as const ref function arguments.
link- whenmoving projectfiles in the "Project" tab, for moved files that are open and are in ME tabs, to automatically update their location path.
link- to introduce typedef declaration functionality in MQL.
link- about providing possibility to force generation of default copy constructors and assignment operators.

 
fxsaber:

The visualiser does not always show the current status for architectural reasons.

Alexey Klenov:
Thanks, I'll keep it in mind.

Cured by running a few ticks (F12) after pausing.

 
Andrey Khatimlianskii:

Cured by running a few ticks (F12) after pausing.

Thank you. I'll give it a try.

 
Sergey Dzyublik:

Another encounter with the previously described bug- "Undefined Behavior, you create a complex wrapped object with internal type "C" several times, but it turns out to be a completely different data type, maybe "B", maybe "int", whatever you want...".
In fact it took a day to localize, reproduce and find workarounds, unfortunately all to no avail...

Finally I managed to find an acceptable solution.
It turns out that using a static class member provides a way around the bug described above:

template<typename _Tp, typename _Opt>
struct It_g{
   class Opt : public _Opt{}; 
   _Tp p;
   
   static Opt opt;
};

template<typename _Tp, typename _Opt>
static It_g::Opt It_g::opt;


template<typename _Tp>
class A_g{
public:
   struct It : public It_g<_Tp, Opt_g<_Tp>>{};
};

template<typename _Tp>
class V{
public:
   struct It : public  A_g<_Tp>::It{};
   It b;
};


template<typename _Tp>
class Opt_g{
   template<typename _It>
   static void test(_It &it){      
      printf(typename(_Tp));          // ClassA*
      printf(typename(it.p));         // ClassA*
      
      _Tp p = it.p;                   // OK
   };
};


template<typename _It>
void test(_It &it){
   it.opt.test(it);
}

class ClassA{};


void OnStart(){ 
   V<int> v1;
   test(v1.b);
   
   V<ClassA*> v2;
   test(v2.b);
   
   V<int>::It it3;
   test(it3);
   
   V<ClassA*>::It it4;
   test(it4);
}
 

How do I fix this storage error?


Gradually it is refusing to save more and more files. Soon everything stored will be impossible to update.

 

The profits/losses in the tooltip for buy stop limit orders and for sell stop limit orders are calculated incorrectly.

When hovering the mouse over tp

when hovering the mouse over the sl

Reason: