- MTx does not have pointers. It only has handles to class objects. GetPointer returns a handle. You can not get a pointer to POD. You can not increment a handle to point to the next array element.
- Don't double post! You
already had this thread open.
General rules and best pratices of the Forum. - General - MQL5 programming forum
Ya Thanks. https://www.mql5.com/en/docs/common/getpointer
I think my question is about "confuse why MQL define this way? There is pointer for object, and struct use POINTER_AUTOMATIC
It's look like MQL
I guess there are some hiding thinking.Object
has life scope issue. Struct don't have ,so for more easy to maintain ,just make it automatic.
In
the first month ,I thought pointer is always automatic , I don't need take care about it. After touch object new and delete. It's look like RD
need define the life scope,ther is no garbage
collection.
Only class objects have pointers. Instances of structures and simple-type variables can't have pointers. The class object not created using the new() operator, but, e.g., automatically created in the array of objects, still has a pointer. But this pointer will be of the automatic type POINTER_AUTOMATIC, therefore the delete() operator can't be applied to it. Aside from that, the type pointer doesn't differ from dynamic pointers of the POINTER_AUTOMATIC type.
Since variables of structure types and simple types do not have pointers, it's prohibited to apply the GetPointer() function to them. It's also prohibited to pass the pointer as a function argument. In all these cases the compiler will notify an error.
.
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I want to make sure variable live scope by check they use the same address.
Want print out address that indicate use the extern int XXX variable. and in EA int XXX variable.
GetPointer is use for class. IF some other ways I can do? Or some doc relative icustom indicator input/output data .