MetaTrader 4 Platform Update build 625: Magazines in MetaTrader Market and New MetaViewer - page 14
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
Wow, not in my MT4 !
2014.03.28 17:44:12.245 v_exp EURUSD,M5: Alert: Volume[1] - 3214
2014.03.28 17:44:13.3343 v_exp EURUSD,M5: Alert: Volume[1] - 756
2014.03.28 17:44:10.218 v_exp EURUSD,M5: Alert: Volume[1] - 3214
2014.03.28 17:44:12.225 v_exp EURUSD,M5: Alert: Volume[1] - 756
2014.03.28 17:44:10.218 v_exp EURUSD,M5: Alert: Volume[1] - 3214
2014.03.28 17:44:11.225 v_exp EURUSD,M5: Alert: Volume[1] - 756
Ah I see your problem now. I am using build 628 and you ?
I am using 625, but I cannot see the problem and I cannot replicate it, but I am using a script as there are no ticks at the weekend.
I always have and still do use commas instead of plus signs in Alerts and Prints. I've never investigated whether using the plus sign can cause difficulties or not.
I am using 625, but I cannot see the problem and I cannot replicate it, but I am using a script as there are no ticks at the weekend.
I always have and still do use commas instead of plus signs in Alerts and Prints. I've never investigated whether using the plus sign can cause difficulties or not.
There are certain times when using comma gives different output instead of using plus signs. Applicable vice versa.
Complex plus returns a complex (value of Add.) Your try assignment says it returns a try but you return a reference (this.) The code crashes but I think it shouldn't compile. Try: try* operator=(...
Try it, it compiled, ran and crashed mt4.
This code crashes MT4. I was following the example in the help:
complex operator+(const complex &r) const { return(Add(this,r)); }
If the function Print() is called from within the body of "operator=":
then there is no crash and the log has a message with the reason of crashing:
Probably, the code "a=o.a" within the body of "operator=" causes "operator=" is called recursively rather than the member "a" is assigned a value of "o.a".
This fact and the fact your original code enforces MT4 to crash (i.e. in case when the function Print() is not called from within the body of "operator=") are definitely the faults of MetaQuotes programmers.
You can avoid stack overflow error by defining the copy constructor (and the default constructor either as when the copy one is defined by a programmer the default one in this case is not generated by the compiler automatically) because the object is copied on "operator=" returning in accordance to its current definition:
This code produces the next messages in the log:
As you can see thanks to the function Print() calls inserted into the code that two object instances of the class "try" were constructed, then "operator=" was called and finally the copy constructor is called. The latter one is called on returning from the "operator=".
By the way, where did you find the information about operator overloading support in the updated MQL4 language from?
...
By the way, where did you find the information about operator overloading support in the updated MQL4 language from?
Everytime i reinstall, it creates another user folder. Any idea how do i point it to the old user folder?
You can't.
See this article Data Structure in MetaTrader 4 Build 600 and Higher
you need to use /portable mode parameter to launch any instance of mt4. I don't see why anyone does NOT use the portable mode. I install separate mt4 installations in one folder outside the program files folder.
This allows you to use the install folder for everything and keeps things much more organized, just like mt4 <b510.
If the function Print() is called from within the body of "operator=":
then there is no crash and the log has a message with the reason of crashing:
Probably, the code "a=o.a" within the body of "operator=" causes "operator=" is called recursively rather than the member "a" is assigned a value of "o.a".
This fact and the fact your original code enforces MT4 to crash (i.e. in case when the function Print() is not called from within the body of "operator=") are definitely the faults of MetaQuotes programmers.
You can avoid stack overflow error by defining the copy constructor (and the default constructor either as when the copy one is defined by a programmer the default one in this case is not generated by the compiler automatically) because the object is copied on "operator=" returning in accordance to its current definition:
This code produces the next messages in the log:
As you can see thanks to the function Print() calls inserted into the code that two object instances of the class "try" were constructed, then "operator=" was called and finally the copy constructor is called. The latter one is called on returning from the "operator=".
By the way, where did you find the information about operator overloading support in the updated MQL4 language from?
This above code did not crash. If expression "a=o.a" causes a recursive call, it is strange that the 2 versions of codes behave differently.
I'm only seeing one value getting returned in your output. Where's the other one?
Sorted out ...
Thank you for your inputs guys!
Explicit type casting.
Thanks!!
This above code did not crash. If expression "a=o.a" causes a recursive call, it is strange that the 2 versions of codes behave differently.
Probably. Or probably not.
What definitely clear is that recursion takes place. And the number of its calls can be easily counted:
Contents of the log:
Execution of the expression "y=x;" definitely caused 160646 calls to "operator=" until stack overflow.