Errors, bugs, questions - page 2697

 
Stanislav Korotky:

Declaring a class inside a function?

Without templates, it works.

 
Bug MT5(build 2375) compilation error when calling a function via its pointer, when an array of pointers to a function is used:

#define  PRINT(x) ; Print(#x, ":", string(x))

void test(){
   PRINT(__FUNCSIG__);
}

template<typename T>
void call(T f_ptr){
   f_ptr();
}


template<typename T>
class A{
public:
   T arr_1[1];
   
   typedef void (*ff)();
   ff arr_2[1];  
   
   
   T test_1(){
      return arr_1[0];
   } 
   
   ff test_2(){
      return arr_2[0];
   } 
   
   T operator[](int index){
      return arr_1[index];
   }
};

void OnStart(){
   typedef void (*ff)();
   ff arr[1];
   arr[0] = test;   
   
   ff f_ptr = arr[0];
   f_ptr();             //Ok
   call(arr[0]);        //Ok
   arr[0]();            //Compile Error: ')' - expression expected   
   
   
   A<ff> a;             
   a.arr_1[0] = test;
   a.arr_2[0] = test;
   
   
   a.arr_1[0]();        //Compile Error: ')' - expression expected   
   a.arr_2[0]();        //Compile Error: ')' - expression expected   
   
   a.test_1()();        //Compile Error: ')' - expression expected   
   a.test_2()();        //Compile Error: ')' - expression expected   
   
   a[0]();              //Ok ???
}


 
Sergey Dzyublik:
MT5(build 2375) bug compilation error when calling a function via its pointer, when an array of pointers to a function is used:

A very ancient bug.

 

Any advice - in MetaEditor open file windows, where is their list saved to open them later?

From time to time ME opens from scratch, although before that a bunch of files have been opened. Could be due to updates.

I want to manually back up the list, or maybe some other solution?

 
Aleksey Mavrin:

Any advice - in MetaEditor open file windows, where is their list saved to open them later?

From time to time ME opens from scratch, although before that a bunch of files were open. Could be due to updates.

I want to manually back up the list, or maybe some other solution?

There is a list in the registry, there is a list in the ini file "metaeditor.ini" via ME ==> File - Open Data Folder (Ctrl + Shift + D) ==> Config ==> metaeditor.ini
You're more likely to need the second one.

 
fxsaber:

A very ancient bug.

I remember for sure that once it worked as it should.
I went to check it and added some more variants of calling pointers to a function from their array.

It turns out that everything works when the array of pointers to a function is inside a class and the specific array element is accessed through operator[].
At the same time, if you use an ordinary function to access an element, a compilation error occurs again... It is a miracle...

 
Is there any way of overriding the automatic rescaling of the indicator? I.e. let's say there are two charts in indicator sub-window, is it possible to make rescaling on vertical axis on one chart and not on the second one? So that the second graph does not affect the rescaling.
 
Bug MT5(build 2375), despite explicit specialization when overloaded template function is called, default template function is still called, which leads to stack overflow.
C++ online(https://onlinegdb.com/BJTFdUDD8)
template<typename T>
void test(T &arr[], T value){
    printf("1");
};

template<typename T, typename TT>
void test(T* &arr[], TT* value){
    printf("2");
    test<T*>(arr, value);
};

class A{};

void OnStart(){
   void* arr[] = {};
   A* ptr;
   test(arr, ptr);         // result: 2,2,2,2,2,2,2,2,...    should be: 2, 1
}
 
bool s_sel = SymbolSelect("", true);
s_sel = true;

Correct this, please.

 

The tooltip gives only one ENUM value.