Errors, bugs, questions - page 1964

 
fxsaber:
...

It's really been a long time coming. Maybe I'm not the only one who's annoyed.


Yes, you're not the only one. )

 
fxsaber:

Please explain the typeof. I couldn't find any good explanation for inexperienced programmers.

I deleted these lines (accidentally).

You have https://www.mql5.com/ru/forum/1111/page1983#comment_5616331 a similar entry like this

template<typename T>
void g( T Value ) { Print(typename(Value)); }
Unimportant difference: there is no Value, because it is redundant
Ошибки, баги, вопросы
Ошибки, баги, вопросы
  • 2017.08.16
  • www.mql5.com
Форум алго-трейдеров MQL5
 
typedef void (*fn)();
void f() {}
void OnStart()
{
        fn ff = f;                   //Результат:
        Print( "1:", typename( ff )); //void(*fn)()
        Print( "2:", typename( f  )); //пусто
}
Empty... why?
 

File search: Search string: 'A\t\tB A'

Missing tab characters in the resulting phrase: Search for 'AB A' in the 'W:' folder

Does not affect the search results, but may cause confusion.



Поиск - Инструменты - Пользовательский интерфейс - Справка по MetaEditor
Поиск - Инструменты - Пользовательский интерфейс - Справка по MetaEditor
  • www.metatrader5.com
В данном окне отображаются результаты глобального поиска и поиска в файлах. Информация представляется в виде таблицы со следующими полями...
 
A100:
Empty... why?
void f() {}
void f( int ) {}
 
ffxsaber:

You have added ambiguity again

#ifdef __cplusplus
void f() {}
void f( int ) {}
void OnStart()
{
        void *ff = &f; //Error: E2336
}
#endif
while f was alone, there was no ambiguity
 
A100:

You've added ambiguity again.

as long as there was one f, there was no ambiguity

Exactly! Now I can call f all sorts of functions and a variable at once. There must be some common sense in such ambiguities, so as not to cause random errors. In my opinion, it is logical to bum around by issuing an empty string to typename f, rather than generating problems when you accidentally pick up and define another f.

 
fxsaber:

Exactly! Now I can call f all sorts of functions and variables at once.

So maybe this possibility is the source of hidden errors!

#ifdef __cplusplus
void f() {}
static char f; //Error: E2238 
#endif
 
A100:

So maybe that's the source of the hidden bugs!

I like that possibility! You just have to be aware of what you are doing.

 
fxsaber:

By the way... IsStopped() returns a bool

void OnStart()
{
        Print( typename( IsStopped())); //bool
        Print(           IsStopped() ); //0
        Print( typename( _StopFlag  )); //int
}

This Print distorts the result (0 instead of false). In any case the contradiction is not (only) in the documentation

https://www.mql5.com/ru/forum/1111/page1980#comment_5612130