Errors, bugs, questions - page 2212

 

Dear developers, please clarify, is it normal that the compiler does not give a warning about type conversion in such a string?

const bool barsToStart = Bars( _Symbol, _Period, startTime, timeCurrent );
 
A100:

If here

(*) implies A::a = 2, not ::a = 2

then S::q = S::z should be implied there too, not S::q = ::z

Why would S::z be implied there, if the expression is not in a function of the S object, but at the global level.

The global level is, that is, ::z is implied - without any of these.

 
Alexey Kozitsyn:

Dear developers, please clarify, is it normal that the compiler does not give a warning about type conversion in such a string?

Strange... It doesn't say anything to me...

 
Georgiy Merts:

That's strange... Mine doesn't say anything...

That's just it, he doesn't write anything. And he should, I think...

 
Alexey Kozitsyn:

That's just it, he doesn't write anything. But it should, I think...

You mean the result of int is converted to bool ?

Yes, in theory, it should generate a warning.

 
Georgiy Merts:

You mean the result of int is converted to bool ?

Yes, it's supposed to give a warning.

Yes, the implicit conversion goes without a warning.

 
Alexey Kozitsyn:

That's just it, he doesn't write anything. But he should, I think...

He should. I can guess why it doesn't. Zero is assumed to be false, anything not zero is true.

that is.

bool b1 = 123; // true
b1 = 0; // false

Probably by these rules they do, although again, I think warning should be

Write in the SD.

 
Alexey Volchanskiy:

Write to the SD

Yes, I did... but no reply. In general, the BODs work strangely: I write an application, the application is accepted for consideration. And then silence. Why should I submit an application if I'm not going to answer it? And so on absolutely every application.

 
Alexey Kozitsyn:

Dear developers, please clarify, is it normal that the compiler doesn't give a warning about type conversion in such a string?

Developers' answer:

Какого предупреждения вы ждёте? 0 это false, не 0 - true.
Это обычная практика в логических выражениях

You need to be more careful.

 
Alexey Kozitsyn:

Dear developers, please clarify, is it normal that the compiler does not give a warning about type conversion in such a string?

Bars see what it returns and what you are trying to equate it to.

const bool barsToStart = Bars( _Symbol, _Period, startTime, timeCurrent ) == 0 ? false : true;