Very strange: a line of code does nothing despite not being commented - page 2

To add comments, please log in or register
mt4ski
244
mt4ski  
The only explanations left are, in decreasing order of likelihood: a MT4 bug, a Windows bug, a hacker... or my computer is possessed by a demon.
Keith Watford
Moderator
24824
Keith Watford  
mt4ski:
The only explanations left are, in decreasing order of likelihood: a MT4 bug, a Windows bug, a hacker... or my computer is possessed by a demon.

And of course, there is another explanation.

The code that you are testing is not the code that you have posted.

mt4ski
244
mt4ski  
Keith Watford:

And of course, there is another explanation.

The code that you are testing is not the code that you have posted.

It doesn't matter if I changed the names of the functions.
Paul Anscombe
4780
Paul Anscombe  
mt4ski:
It doesn't matter if I changed the names of the functions.

just post the whole code already..... so the error can be found

the most logical scenario is that you are calling okay() from elsewhere in your code and not from the function with BEGIN in it....

Drazen Penic
3220
Drazen Penic  
mt4ski:
The only explanations left are, in decreasing order of likelihood: a MT4 bug, a Windows bug, a hacker... or my computer is possessed by a demon.

Yeah, you forgot one thing: cosmic radiation.

Your computer is located on path of a stream of high energy (still unknown) particles flowing from some star that exploded billion years ago.

Try moving your PC to another room. Tin foil might also help (on a computer, not on your head).

mt4ski
244
mt4ski  
Paul Anscombe:

just post the whole code already..... so the error can be found

the most logical scenario is that you are calling okay() from elsewhere in your code and not from the function with BEGIN in it....

   Sorry but my issue cannot be explained with more clarity. Introducing irrelevant code won't help at all.

   But because I'm patient with you guys...

   There is only one strange() function, and a message is printed indicating that it was called.
   It doesn't matter from where it is called: "BEGIN" should be printed but is not. 

   I didn't expect anyone to be able to help anyway...

mt4ski
244
mt4ski  
Drazen Penic:

Yeah, you forgot one thing: cosmic radiation.

Your computer is located on path of a stream of high energy (still unknown) particles flowing from some star that exploded billion years ago.

Try moving your PC to another room. Tin foil might also help (on a computer, not on your head).

  Don't mock me. Have you not seen how strangely the above MQL4 code behaves ?

Drazen Penic
3220
Drazen Penic  
mt4ski:

  Don't mock me. Have you not seen how strangely the above MQL4 code behaves ?

It's not mocking, just a reasonable conclusion based on the code you posted.

Since we don't have complete test sample that reproduces your problem, we have to include all possible reasons. 

Keith Watford
Moderator
24824
Keith Watford  

Your code

void okay()
{
   strange(); 
   Print("FUNCTION WAS CALLED");
}

void strange()
{
   Print("BEGIN");
   
 // remaining code 
}

okay();

Your code presented properly

int OnInit()
{
   okay();
   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
}
//+------------------------------------------------------------------+
void OnTick()
{
}
//+------------------------------------------------------------------+
void okay()
{
   strange();
   Print("FUNCTION WAS CALLED");
}
//+------------------------------------------------------------------+
void strange()
{
   Print("BEGIN");
// remaining code
}
//+------------------------------------------------------------------+

Result

0 17:53:14.917 Empty USDJPY,H1: BEGIN

0 17:53:14.917 Empty USDJPY,H1: FUNCTION WAS CALLED

0 17:53:14.917 Empty USDJPY,H1: initialized

As I said, the problem is that you are not testing the code that you have posted.

Keith Watford
Moderator
24824
Keith Watford  
Keith Watford:

Result

0 17:53:14.917 Empty USDJPY,H1: BEGIN

0 17:53:14.917 Empty USDJPY,H1: FUNCTION WAS CALLED

0 17:53:14.917 Empty USDJPY,H1: initialized

As I said, the problem is that you are not testing the code that you have posted.

As there has been no further reply from the OP we can only assume that he was testing different code.

To add comments, please log in or register