Errors, bugs, questions - page 3062

 

This is where the compiler should give an error:

class A
  {
public:
   int               aa;
  };
A a;

void OnStart()
  {
   a.aa=999999;
   A b=GetPointer(a);//Переменная b не является указателем
   Print(b.aa);
  }

The script prints nines.

 
Aliaksandr Hryshyn:

This is where the compiler should give an error:

Script prints nines.

Forum on trading, automated trading systems and strategy testing

New version of MetaTrader 5 build 2980: Push notifications on trade operations

A100, 2021.06.21 08:35

In MQL, pointers are not actually pointers (no address arithmetic), but references

And if so, the implicit conversion ofa reference pointer to an object works

In C++ it would look like this


#ifdef __cplusplus
#define GetPointer(a)   ((A&)(a))
void OnStart()
{
   a.aa=999999;
   A b = GetPointer(b);
   Print(b.aa);
}
#endif
 
A100 :

And since this is the case, an implicit pointer-to-object conversion works

In C++ it would look like this:

Since you are very knowledgeable about OOP. May I ask your opinion about it?

Bug: Const method + Copy constructor
Bug: Const method + Copy constructor
  • 2021.07.18
  • www.mql5.com
This code reproduces the bug: There are 2 workarounds for this code, you either remove the const qualifier from the method foo or create a temporar...
 
fxsaber:

On the remote machine, this only started happening after some time. Before that, everything was working properly. I can't remember changing anything in the OS.

I remember something similar. Probably had something to do with the RDP connection.

And switching by windows with Alt+Tab seemed to help.

 
Andrey Khatimlianskii:

I remember something similar. Probably had something to do with the RDP connection.

And it seemed to help to switch by windows with Alt+Tab.

Unfortunately, it didn't help. Until I close Alert, the terminal is still not visible.

 
Alain Verleyen:

Since you are very knowledgeable about OOP. May I ask your opinion about it?

In C++ everything compiles without errors, in MQL without const (3) - it compiles too - it means that somewhere in MQL there is an error.

class C {
public:
    C()           { Print( 1 ); }  
    C( const C& ) { Print( 2 ); }
    C h()         { Print( 3 ); return C(); }    //(3) нормально
    C f() const   { Print( 4 ); return C(); }    //(4) ошибка при компиляции
    C g() const   { Print( 5 ); C c; return c; } //(5) замена (4)
};
void OnStart()
{
    C c;
    c.f();
}

On the other hand - even if (4) did compile, the sequence of calls would still be different:

in MQL: 1-4-1-2

in C++: 1-4-1

so it's more correct to use variant (5) in any case

 
A100 :

In C++ everything compiles without errors, in MQL without const (3) - also compiles - it means that somewhere in MQL there is an error

On the other hand, even if (4) did compile, the sequence of calls would be different:

in MQL: 1-4-1-2

in C++: 1-4-1

so it's more correct to use variant (5) in any case

Thank you :-)
 

Darn, I still don't get it, so tell me, people of goodwill:

To prevent all open files in Metaeditor from crashing at the perfect moment, what do I have to do?

Metaeditor.ini manually backed up or what? seriously.

Just that not even after closing/opening, but right in the open all of a sudden everything is gone. The reason is unclear.

 
Aleksey Mavrin:

Darn, I still don't get it, so tell me, people of goodwill:

To prevent all open files in Metaeditor from crashing at the perfect moment, what do I have to do?

Metaeditor.ini manually backed up or what? seriously.

Just that not even after closing/opening, but right in the open all of a sudden everything is gone. The reason is unclear.

I don't flip, I use it as a portable version.
 

There is a customer. I have done his work. He wanted to work with me again. Created a job. Could not figure it out or he was missing a step where he needs to attach a specification.

Deleted the job. According to the rules, you can only create one job. Can not create, wants to create another account. (I advised him not to do this, and wrote that I will try to address myself in support).

Offered to pay in advance not here, to which I refused. Because it is not fair to the third party (MKL).

Please give him the opportunity to create a job here.

Somehow this is not right. There is a person willing to pay for the work, there is a performer who agrees to do it and pay a commission. The process is halted.

https://www.mql5.com/en/users/mbende/feedbacks

Reason: