Errors, bugs, questions - page 1662

 
fxsaber:

Why the warning on a flat spot?

There is no overloading of this function with uchar. There is only char. That's why it alerts if the constant is bigger than 127.
 
Sergei Vladimirov:
There is no overloading of this function with uchar. There is only char. That's why it alerts if the constant is larger than 127.
Why doesn't this error occur at all? Because there is no overloading for uchar arrays (if the reference is true).
 
Alexey Viktorov:

If it shows values similar to the truth, but counts on the wrong data, it turns out that the problem is in mql5 and not in the tester or visualizer.

In general, thank you for your participation, I will be fighting the problem in the long run. And will check on another, similar section of currency today. Maybe it's the ticks problem at this location, hhz?

Checked it. Everything counts fine. Apparently there's a bug in the generation of ticks at a particular place in the story.
 
fxsaber:
Then why is there no error at all? There is no overloading for uchar arrays (if the help is correct).
Now this is a valid question.
 
fxsaber:
Then why is there no error at all? Because there is no overloading for uchar arrays (if the help is correct).
Apparently because the arrays are identical. The difference between char and uchar is only in the interpretation by the compiler. In fact there should be no warning there either, because nothing is actually truncated, you can verify.
 
Alexey Navoykov:
Apparently because the arrays are identical. The difference between char and uchar is only in the compiler interpretation. In fact there should be no warning there, because nothing is actually truncated, you can make sure.
It is copied byte-by-byte there. So with all signed <-> unsigned.
 
A100:

But this (and previous ones with typedef) are incidental errors - I have not found the main one yet, because there is no typedef with the same signature in the source program (as in this example).

I was able to make a test script close to the source program with an error during execution

//Script1.mq5
typedef int (*GTW)( uint, uint, int );
#import "Script2.ex5"
        void f( GTW );
#import "Script3.ex5"
        int g( uint, uint, int );
#import
void OnStart() { f( g ); }
//Script2.mq5
#property library
typedef int (*GTW)( uint, uint, int );
void f( GTW ff ) export { ff( 0x1, 0x1, 0 ); }
//Script3.mq5
#property library
int g( uint, uint, int ) export
{
        Print( __FUNCSIG__ );
        return 0;
}

Result: invalid function pointer call in 'Script2.mq5

And now the trick... - Replace GTW in all files with GT and check the result !

 

Please advise on the syntax, how to correctly rewrite a function like this

MqlTick Func()
{
  MqlTick Tick = {0};
  
  return(Tick);
}

to something like

MqlTick Func()
{
  return(MqlTick(0));
}

or something like this

MqlTick Func()
{
  return(new MqlTick);
}

I.e. don't write a separate part creating the structure to be returned.

 

Recently (since about a month) in discussions about 'Work' service projects, after typing a shitload of text with quotes and illustrations, after submitting it all goes into ... hole #403


No re-sending the form doesn't help - after reloading the page I have to type everything in again

Dear editor, can you please explain what new revolution has been invented for the benefit of users, and how to get away from it?
 
Alexander Puzanov:

Recently (since about a month) in discussions about 'Work' service projects, after typing a shitload of text with quotes and illustrations, after submitting it all goes into ... hole #403


No re-sending the form doesn't help - after reloading the page I have to type everything in again

Dear editor, can you please explain what new revolution has been invented for the benefit of users, and how to get away from it?
In the top-left corner of the editor, ALWAYS press the HTML button, then CTRL+A and CTRL+C before you send a big post. That way everything stays in the buffer. And if an error occurs. You will have to use the HTML button again, and then CTRL+A and CTRL+V. It'll save a lot of stress.