Errors, bugs, questions - page 2868

 
Vladimir Simakov:
No, the developers' logic is understandable, but for me, I'd rather specify u'y' explicitly when and if I need it

It's just not clear how the char type is defeated.

 
A compilation error:
void OnStart()
{
        Print(typename( char(0))); //Error: '0' - some operator expected
}

but this way:

        Print(typename((char)0) ); //нормально

What difference does it make?

 
A100:
Compilation error:

but this way:

What difference does it make?

It seems that only "(type) value" is a type conversion, but "type (value)" is a kind of initialization, which in your case can't return anything. Haven't opened μl for a long time though ))

 
Alexandr Andreev:

In µl, only "(type) value" seems to be a type conversion, but "type (value)" is a kind of initialization, which in your case can't return anything. Haven't opened μl for a long time though ))

So openhttps://www.mql5.com/ru/docs/basis/types/casting

Unit: Conversion of numeric types."Explicit type conversion is written as follows"... further in the text

Документация по MQL5: Основы языка / Типы данных / Приведение типов
Документация по MQL5: Основы языка / Типы данных / Приведение типов
  • www.mql5.com
Часто возникает необходимость преобразовать один числовой тип в другой. Не каждый числовой тип допустимо преобразовать в другой, допустимые преобразования в MQL5 показаны на схеме: Сплошные линии со стрелками обозначают преобразования, которые выполняются без потери информации. Вместо типа char может выступать тип bool (оба занимают в памяти 1...
 

Yeah checked it out too, I remember coming across this a long time ago about what I wrote above. I apologise for the wrong information).

 
A100:
Compilation error:

but this way:

What difference does it make?

Yes, this is also a compilation error

#define  J '+'          // char

void OnStart()
{
    Print((typename)J);
}
#define  J '+'          // char

void OnStart()
{
    Print((typename)(J));
}
 
Vladimir Simakov:
The developers' logic is quite clear but, as for me, I'd better specify u'y' clearly when and if I need it

I don't understand this logic. When there is a total optimization everywhere and everywhere, and reduction of resources as a priority,
why make the basic character type in Unicode increasing it to 2 bytes.
Hence the mql string type turns out expensive.
Really, it is better to have an additional specifier u'sh'

char by the ghost of the type is only substituted.

#define  J (char)'+'     // char

void OnStart()
{
    Print(J);           // 43
    Print(typename(J)); // char
}

But in this case we have a difference of types.

#define  J '+'              

void OnStart()
{
   Print(J);                // 43
   Print(typename(J));      // ushort
   Print(typename(char));   // char
}

It's a real mess with this Unicode.

 
Roman:

Yes, this is also a compilation error.

You have a syntax error - give us an example of working code with (typename) in brackets. You might as well write (OnStart) in brackets, too

 

Another example of questionable MQL compiler message:

#ifdef __MQL__
void OnStart() {
{
}
#endif //Error: '#endif' - unexpected end of program

what does #endif have to do with it - and how do you guess where the error actually is?

at the time C++ informs about the error

#ifdef __cplusplus
void OnStart() {
{
} //Error: expected '}' at end of input
#endif
 

I hope mql developers are reading this page.

When will you guys make a normal validator?

There is a bug in validator for mt4. It's impossible to get open/close price, Hi/Low candles data from other timeframes.

Reason: