Errors, bugs, questions - page 1981

 
A100:

This doesn't really change anything - compilation error (I have a tablet - Borland compiler)

Hmm, so you have to go to the language standards and see whose compiler is messing up.
 
Alexey Navoykov:
Hmm, so we have to look into language standards and see whose compiler is messing up.
The second option is similar

#ifdef __BORLANDC__
class B;
class A {
        int g( B * );
        int i;
};
class B : public A {};
int A::g( B *b ) { return b->i; } //Error: E224
#endif

VS 2010 fails because it overcomes private by implicit conversion from B* to A*


#ifdef __BORLANDC__

class B;
class A {
        int g( B * );
        int i;
};
class B : public A {};
int A::g( B *b ) { return ((A *)b)->i; } //нормально

#endif

 
Alexey Navoykov:
Hmm, so we have to go to the language standards and see whose compiler is messing up.
gcc 7.2 compiles the latest version, checked here
Compiler Explorer - C++
  • About the author
  • godbolt.org
These settings control how Compiler Explorer acts for you. They are not preserved as part of shared URLs, and are persisted locally using browser local storage.
 
Комбинатор:
gcc 7.2 compiles the latest version, checked here

The result is the following table

class B;
class A {                                       //MQL //BCC //VS2010 //gcc
        int f1( B *b ) { return       b .i;   } // -     -     +        +
        int f2( B *b ) { return       b .g(); } // +     -     +        +
        int f3( B *b ) { return ((A *)b).i;   } // +     +     +        +
        int f4( B *b ) { return ((A *)b).g(); } // +     +     +        +
        int f5()       { return       b .i;   } // -     -     +        +
        int f6()       { return       b .g(); } // +     -     +        +
        int f7()       { return ((A *)b).i;   } // +     +     +        +
        int f8()       { return ((A *)b).g(); } // +     +     +        +
//---
        int g() { return 0; }
        int i;
        B *b;
};
class B : public A {};

And msdn says: Access control helps prevent objects from being used for unauthorized purposes. This protection is lost when explicit type conversions(type conversions) are performed.
 

Hi all.

Can you tell me if there is any way to remove the indicator window that appears in the strategy tester when the visualisation is enabled?

It is generated by wizarda in MT5.

I read in MQL5 documentation that IndicatoRelease does not work in Strategy Tester. (I tried to insert this function into OnDeinit anyway, it starts complaining that a handle is not declared. I declare it, it generates other errors).

Is there any other way?

 
Ahmet Garyagdyyev:

Hi all.

Can you tell me if there is any way to remove the indicator window that appears in the strategy tester when the visualisation is enabled?

It is generated by wizarda in MT5.

I read in MQL5 documentation that IndicatoRelease does not work in Strategy Tester. (I tried to insert this function into OnDeinit anyway, it starts complaining that a handle is not declared. I declare it, it generates other errors).

Is there any other way?


You can change the template with all indicators, to any of the previously saved by you.

 
A100:

The result is the following table

VS and gcc have long been regarded as the reference* (or at least largely less bug-prone) than Borland. I've used Borland myself for many years, but based on its other advantages.

PS. *this is not my personal opinion; I won't discuss it.

 

Colleagues, has anyone encountered attempts to implement an STL c++ library (making allowance for language capabilities)? Preferably with codobase placement, search says no, but vrdug ... . Certainly not all, but some basic stuff: a few normal containers via templates, and that auto_ptr (I certainly wrote my own, but self-writing such primitives is silly).
I don't understand why std µl is non-template and why we had to invent new names for methods/classes analogues in STL.

 

I found a mistake, I'm not going to insert compiled text completely, I'll pull pieces from script:

class Source : public CObject
{
public:
   upindex_t start, top, lstart, ltop;
};

CArrayObj sourcear;

do
{
   Source *new_src = new Source;
   new_src.start = last.start;
   new_src.top = last.top;
   new_src.lstart = prev_prev.start;
   new_src.ltop = prev_prev.top;
   if( ! sourcear.Add(new_src) )
      return;
}
while(...);

for(int i = 0;  i < sourcear.Total();  ++ i)
{
   Source cursrc = (Source*)sourcear.At(i);  //!!!!! Это не вызывает ошибки во время компиляции
}

I.e. cast: CObject*--> Source* --> Source

Or is it some kind of tricky MQL Specific?


ZS: and such a string is eaten:

Source new_src = new Source;

That's nonsense. No copying cons/operators in the language, I haven't dereferenced it. What's going on here?

 
pavlick_:

Or is it some tricky MQL Specific?

class A {};

void OnStart()
{
  A a = new A;
}

The default copy operator is triggered.