MQL5 The compiler does not distinguish between a class and a pointer to it - page 9

 
fxsaber:

Was sure this was not in the MQL! I wonder where the legs in my head came from...

I wonder if there is even one example of this in KB or Documentation? Didn't stupidly see one...

Such coincidences are rare, because some notorious guy from this and other forums answered me in autumn, that pointers are such pointers, they are basic types and what can you take from them... But it works now, and thank goodness.

 
fxsaber:

Was pretty sure that wasn't in the MQL! I wonder where did the legs grow in my head like that, not just me...

Not the only one.

 
fxsaber:

I wonder if there is even one example of this in the KB or Documentation? Didn't you stupidly notice...

Found only this

Forum on trading, automated trading systems & strategy testing

Errors, bugs, questions

Ilyas, 2018.11.22 09:37

As a temporary solution, use operator '!' (logical not)

class A {};

A* a = NULL;

bool b1 = !!a && true;
bool b2 = true && !!a;


We will think on the solution (can we change the behaviour now, when there is a large number of codes ?)
It's possible that for a pointer, a bool conversion operation would be an operation on the pointer and not on the object it points to.

In this case, to perform the operation on the object, we will need to write the code like this

class A {};

A* a = NULL;

bool b1 = * a && true;
bool b2 = true && * a;

The ghost operators, too, we want to add, but this task is (very) non-priority
 
fxsaber:

Found only this

22.11.2018? Three years, yep yep yep...

 
Ilya Malev:

22.11.2018? Three years, yep yep yep....

It wasn't an announcement of a feature, but an example of how to use it.

 
fxsaber:

This was not an announcement of a feature, but an example of how to use it.

not explaining it is simply unseemly...

 

Here is a recent quote

Ilyas:

The dereferencing operation (getting the actual pointer from the handle) is "internal" (not custom) and expensive (compared to not having it) code.

It's quite possible, of course, that the admin meant something else entirely...

But there is absolutely nothing in the documentation about this operation. It is unrealistic that an operation has been working for 3 years and it was not reflected in the help or on the forum

 
fxsaber:

I only found this

That's not it. I remember A100 and I asked about adding * and & operators in the same thread a long time ago, and they were added.
 
Here's a link to that discussion. Turns out it's been almost 3.5 years. How time flies...
 
Alexey Navoykov:
Here's a link to that discussion. Turns out it's been almost 3.5 years already. How time flies...

And how much more time flew by before these operations were actually introduced... Only the wind probably knows. And so, yes, pretty important things can be brought up on the forum for years without much success