You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I have some misunderstanding with pointers in MQL5 - a very "unspecified thing".
I ran into a problem with a test script (I have the library attached):
this code will delete the pointer, everything is OK.
I wanted to write it this way at first:
when running the script, I get: 1 object of type JSONParser left
so how do i remove this JSONParser outside of the function ?
I have some misunderstanding with pointers in MQL5 - a very "unspecified thing".
I ran into a problem with a test script (I have attached the library):
this code will delete the pointer, everything is OK.
I wanted to write it this way at first:
when running the script, I get: 1 object of type JSONParser left
so how do i remove this JSONParser outside of the function ?
You have to create a temporary object on the stack in this case)))
this is my first example, I create JSONParser in local scope there, it will be deleted when I exit the function
The question is, basically, that such things as an example #2 Sharp will swallow, and here I still need to think... in general Sharp is more succinct than Pros!!! - so for a cholivar! )))
this is my first example, I create JSONParser in local scope there, it will be deleted when I exit the function
the question is, in principle, that such things as an example number 2 Sharpe will swallow, and here you still need to think ... in general Sharp is more succinct than Pros!!! - so for a cholivar! )))
You create a pointer to an object in a local area and the object itself is in a heap and it's the object that leaks).
I told you Sharpe rules! )))
Nn, in general, the first option I will use and will not bother the brain, thank you for participating!
I don't understand the behaviour of pointers in MQL anyway, this code works without any problems and will delete all dynamically created objects at the end of the script:
why does it work? i have deleted the JSONParser *parser object, so it should get all related pointers as NULL
I don't understand the behaviour of pointers in MQL anyway, this code works without any problems and will delete all dynamically created objects at the end of the script:
why does it work? i just deleted JSONParser *parser object, so it should get all pointers as NULL
why ?
Again, this isn't Sharp, there's no such thing as "linked references"... The object lives until the programmer personally kills it, regardless of references.
why would I do that?
again this isn't sharpe, there's no such thing as "linked references"... The object lives until the programmer kills it personally, regardless of references.
Well, that's the question, we have a workable variant of the code, but the pointers' behavior is unclear to me
In theory, variant 2 from the first message should work
I wonder if the Dunning-Krueger effect is stinging anywhere?
how cheeky I am here...
you got a knowledge discount, I didn't get a discount) even though they're all expensive