Errors, bugs, questions - page 2065

 
Comical situation
class B;

class A
{
protected:  
  int i;

public:  
  void operator =( const B* Value )
  {    
    this.i = Value.i;       // 'i' - protected member access error
    
    // А так можно!
    this.i = ((A*)Value).i; // и нет ошибки: cannot convert from const pointer to nonconst pointer    
  }
};

class B : public A {};


I thought the situation would be the same in both cases. But no!

 
You can only do that inside Class A. Sounds fine to me.
 

fxsaber:

How do you know the name of a file from its handle?

As far as I remember, there is no way
 
Комбинатор:
You can only do this inside class A. Seems fine to me.

error

    this.i = Value.i;       // 'i' - protected member access error

has already been fixed, please wait for the new build.

 

ошибка

has already been fixed, please wait for the new build.

They know best. a mistake is a mistake
 

MetaEditor adds a point to the filename

Sequence of operations:

  • In Explorer create a Test.txt text document
  • Open it in MetaEditor via File/Open
  • Then select File/Save As...


As a result the file name will be Test2..txt instead of Test2.txt

Notepad, all other things being equal, does not add extra dots to the file name
 

fxsaber:

has already been fixed, please wait for the new build.

We need to see how exactly it is fixed because in a similar case the Microsoft compiler requires for a reason to take the implementation of the method (in this case operator =) outside the class

https://www.mql5.com/ru/forum/1111/page2001#comment_5679732

https://www.mql5.com/ru/forum/1111/page2001#comment_5680465

Ошибки, баги, вопросы
Ошибки, баги, вопросы
  • 2017.08.29
  • www.mql5.com
Общее обсуждение: Ошибки, баги, вопросы
 

This seems to be the wrong behaviour for the language, as it limits the possibilities.

struct A {};

class B
{
public:
  const A a;
  
  B( const A &in ) : a(in) // 'a' - constructor not defined
  {
  }
};


I need to define a const field as a structure. I thought the copy operator would work, but the compiler wants a constructor instead, because the syntax is similar. But it is wrong.

 
Incorrect error message
struct A
{
  const int i;
};

void OnStart()
{
  A a1, a2;
  
  a1 = a2; // '=' - not allowed for objects with protected members or inheritance
}
 

Forum on trading, automated trading systems and trading strategy testing

Bugs, bugs, questions

fxsaber, 2017.05.19 22:35

TimeTradeServer can return all sorts of nonsense. For example, a value less than TimeCurrent. This completely nullifies its practical application.

If I understand the idea correctly, the TimeTradeServer must calculate the elapsed time after receiving TimeCurrent and add this difference, sort of emulating the future TimeCurrent values.

Now, having run the Expert Advisor

#define  TOSTRING(A) #A + " = " + (string)(A) + "\n"

void OnInit()
{
  EventSetTimer(1);
}

void OnTimer()
{
  Comment(TOSTRING(TimeTradeServer()) + TOSTRING(TimeCurrent()));
}

you can see any nonsense.

Note the dates.


This is how TimeTradeServer returns local time. Once again, please correct the correct behavior.