Errors, bugs, questions - page 2326

 
TheXpert:
there's no concept now, an object and a pointer to it are mixed up in one pile

This allows pointers to be handled as objects, which in some cases gives a simpler and clearer notation without *

and such pointers can also be used as references

And now they propose to destroy it all and return to the Stone Age for the sake of no one knows what

 
A100:

And now they are proposing to destroy it all and go back to the Stone Age for who knows what.

well, that's your opinion. i think exactly the opposite.

 
TheXpert:

Well, that's your opinion. I think exactly the opposite.

What exactly don't you like? That a pointer in MQL is actually a reference? And the address arithmetic in MQL makes no sense, and therefore it's not used!
 

A100:
А что конкретно Вас не устраивает? Что в MQL указатель это фактически ссылка?

actually that's not true )

While in MQL address arithmetic is meaningless and therefore not used!?

smart pointers also don't have address arithmetic, but they are used for some reason
 
TheXpert:

actually it's not )

smart pointers also don't have address arithmetic, but they are used for some reason

Strictly speaking, no, but in the absence of address arithmetic, an MQL pointer\writer is closer (or at least not further) to a C++ reference than a C++ pointer

And if so, the syntax must be preserved accordingly (without *)

 
Ilyas:

No, there were no serious reasons.

The only justification for its absence is to take care of the fragile minds of users unfamiliar with C++.

 
A100:

Strictly speaking, it's not, but in the absence of address arithmetic the pointer/mQL pointer is closer (or at least not further) to a C++ reference than to a C++ pointer

And if so, the syntax should be stored accordingly (without *)


 
A100:

Why make it so complicated? It is enough to make . and -> equivalent, interchangeable records

Figuratively speaking.

If you make them interchangeable, you simply don't need them both.

In C++, this is possible:

class A
{

public:
   void f();
};

class PtrA
{
  A* mPtr;

public
   PtrA( A* a ) : mPtr( a ){}

   A* operator->()
   {
      return mPtr;
   }

   void f();
};

PtrA a( new A );

a.f();   //  Это две разные функции
a->f();  //
 

The operator -> should really be added to the language, firstly for the purpose of compatibility with C++ codes and secondly to allow overloading (which is useful for smart pointers).

The dot is a universal operator in MQL.

 

Why hasn't MQL fixed the bug that a base class is implicitly cast to a derived class? Not even a compiler warning!

class A {  };

class B : public A { };

A a;

B* b= &a;  // Нет ошибки