Errors, bugs, questions - page 2761
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
0xFF is probably turned into 4 bytes by the compiler.
no, but it initialises correctly
Good afternoon, please advise how to solve the problem:
During optimization an error pops up:
2020.05.31 15:05:32.738 Core 7 genetic pass (0, 53) tested with error "critical runtime error 503 in OnTick function (zero divide, module Experts\e1.ex5, file e1.mq5, line 826, col 73)" in 0:00:00.153
double Mix1 = NormalizeDouble((MathAbs(ZExtLevel[0] - ZExtLevel[1]), 2)
double Mix2 = NormalizeDouble((MathAbs(ZExtLevel[1] - ZExtLevel[2])), 2);
double Mix = NormalizeDouble((Mix1/Mix2),2);
What I did:
1) I multiplied Mix1 and Mix2 to reduce number of decimal places;
2) changed quantity of digits in normalization;
3) Checked all ZExtLevels to make sure they do not contain 0.
No, but it initialises correctly
Why are you sure it doesn't? The default in Integer is to present. sizeof says so.
Why are you sure it doesn't? The default in Integer is to present. sizeof says it does.
uint, to be precise.
Why are you sure it doesn't? The default in Integer is to present. sizeof says so.
does it also work without any warnings?
Because there is a corresponding signatureArrayInitialize
and for some unknown reason they didn't create ArrayInitialize() for unsigned uchar
works the same way without any warnings?
because there is a corresponding signature ArrayInitialize
and for an unsigned uchar they did not do ArrayInitialize() for some unknown reason.
It's not about the signature or absence of it. The point is that 4 bytes are converted into 1 and information can theoretically be lost - this is what the compiler warns about.
TryArrayInitialize(c, (char)10000);
there will also be a warning
It's not about the signature or lack thereof. The point is that 4 bytes are converted to 1, information can theoretically be lost which is what the compiler warns about.
TryArrayInitialize(c, (char)10000);
there will also be a warning
Well, it was clear from the very beginning
The question is here in a different way - where do you really need char?
I use uchar in StringToCharArray() and CryptEncode() and if you look through the help you'll find more
that's why I can initialize a char array using ArrayInitialize, but uchar I cannot do it
ok, that's a great hullabaloo, I doubt it will change ;)
PS: 0xFF = 255 (1 byte)
yes it's clear that was all from the beginning
here the question is different, this is where char is really needed?
I use uchar in StringToCharArray () and CryptEncode (), and if you go through the help there are still
so that's why i can initialize a char array using ArrayInitialize, but uchar can't
ok, the noble holivar turned out, I doubt that something will change;)
PS: 0xFF = 255 (1 byte)
Yeah, that's what it was all about from the beginning.
Here's another question. Where do you really need char?
I use uchar in StringToCharArray() and CryptEncode().
that's why I can initialize a char array using ArrayInitialize, but uchar I cannot do it
ok, that's a great hullabaloo, I doubt it will change ;)
PS: 0xFF = 255 (1 byte)
I don't know why you can't. uchar works the same way as char.
You asked why you got the warning, because 4 bytes in 1. 255 is not important. 0 and 1 can be 1 and 2 and 4 and 8 bytes)
Alain Verleyen:
checked:
OK, works without any compiler warnings
Thank you