This warning points you to a type cast and you can prevent this warning if you explicitly write e.g. the designated type in front of the variable: int a = 2; double x = (double)a; (or: double a = double(a).
This warning points you to a type cast and you can prevent this warning if you explicitly write e.g. the designated type in front of the variable: int a = 2; double x = (double)a; (or: double a = double(a).
Thanks Carl
I know it, But why i should see this warning when i don't see before.
for example in below code i didn't see this warning:
{ for(char i=1;i<ArrayRange(r_s,0)-2;i++) if(Bid>=r_s[i][0] && Bid<r_s[i+1][0])return(i); return(-1); }
if(UnderPrice((double)i+1)-...Plz let me know if the warning gone
Try double to the variable i
Hi Mohammed;
It solved with (char) not with (double).
However i need an answer for this question:
why i should see this warning when i don't see before.
for example in below code i didn't see this warning:
{ for(char i=1;i<ArrayRange(r_s,0)-2;i++) if(Bid>=r_s[i][0] && Bid<r_s[i+1][0])return(i); return(-1); }
char i=2; Print(typename(i+1)); // int
i is a char. One (1) is an int, therefor i+1 is also an int. But your function takes a char not an int. Thus the error.
Either cast the one to a char before adding. Cast the sum for the function call. Or, just use an int and stop using char.
i is a char. One (1) is an int, therefor i+1 is also an int. But your function takes a char not an int. Thus the error.
Either cast the one to a char before adding. Cast the sum for the function call. Or, just use an int and stop using char.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi there;
I have problem with this warning.
I wrote a function(double UnderPrice(char variable)) that takes a "char" parameter and gives a double one.
but when i call it and compile it say a warning (possible loss of data due to type conversion) for "char" variables that add with a positive number
Please help me.