MetaTrader 4 Build 574 with Updated MQL4 Language and Market of Applications Released - page 21

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
struct RateInfo defined in ExpertSample.cpp is 44 bytes long with MT4 <= 509. In the new version, each RateInfo record is 60 bytes long (for both old EAs and new EAs). Therefore, existing DLLs receiving RateInfo data from ArrayCopyRates() will stop working. Confirmed by Service Desk.
I just found this problem.
So how can I to make DLL receive the correct RateInfo data?
I just found this problem. So how can I to make DLL receive the correct RateInfo data?
https://www.mql5.com/en/forum/148851/page15#898140 may mean that this will be changed back before launch so that old EAs use the old RateInfo structure.
If not, or if you want to recompile your EAs with the new version of MT4, then you need to change your DLL (or add a second version of each function0.
So re: my earlier post is it normal behaviour for a uint to change its value and turn negative when typcasted to an int ?
Output: uticks = 3862831595 iticks = -432135701
So re: my earlier post is it normal behaviour for a uint to change its value and turn negative when typcasted to an int ?
So it is not because the uint is too big for the int ? I just had a thought that maybe it is so I looked up the max values ...
So re: my earlier post is it normal behaviour for a uint to change its value and turn negative when typcasted to an int ?
Output: uticks = 3862831595 iticks = -432135701
Yes,
int
4
- 2 147 483 648
2 147 483 647
int
uint
4
0
4 294 967 295
unsigned int, DWORD
uticks is too large for an int so it wraps round to a negative.
Yes it works properly when I change the int to a long.
So it is not because the uint is too big for the int ? I just had a thought that maybe it is so I looked up the max values ...
In both cases, the sequence of bits stored in the computers memory remains constant as 11010111 10000100 01111100 01100111
What changes is how that sequence is interpreted. As an int, the top bit (marked in red) is interpreted as a sign for the other 31 bits, where 1 means "negative number". The 31-bits can have 2 147 483 648 possible values, which are interpreted as either positive or negative depending on the top bit.
As a uint, the 32 bits are simply interpreted as a 32-bit value between 0 and 4 294 967 295
OK yes I see what your saying now. Thanks for the explanation.
Alright I think I've got uints down, time to move on to the next step, so what is polymorphism again ? ;)
OK yes I see what your saying now. Thanks for the explanation.
Answering a question which I think you've just deleted, MT4 seems to have different type-casting rules to other languages such as C.
In the following code, the negative int value becomes a positive long value:
I find that surprising. In the C equivalent, the sign of the int is preserved when casting to a long int:
In fact, unless my brain is addled at the end of a long day, I think the MT4 behavior is not just confusing, but wrong.