Errors, bugs, questions - page 1331

 

Like this - there would really be an ambiguity

void f( uint )  { Print( __FUNCSIG__ ); }
void f( int  )  { Print( __FUNCSIG__ ); }
void OnStart()
{
        char ch = 0;
        f( ch ); // неопределенность 
}

which is strangely overcome by the compiler if you rewrite the example differently

#import "Test.ex5"
        void f( uint );
#import
        void f( int  )  { Print( __FUNCSIG__ ); }
void OnStart()
{
        char ch = 0;
        f( ch ); // вызывается f(int), а должна генерироваться неопределенность
}
 
Your truth
 
I don't know if this has been mentioned before. In MetaEditor, if input variable name coincides with local variable name (or class field name), the latter is highlighted in red everywhere, just like input variable. This causes confusion when reading code. We should fix this.
 
Alexey Navoykov:
I don't know if it's been said before or not. In MetaEditor if input variable name coincides with local variable name (or class field name) the latter is marked red everywhere, as well as input variable. It causes confusion when reading code. We should fix this.

giving identical names to code entities is an attempt to shoot oneself in the foot :)

It's easier to change the name of an input variable and you won't have any problems and confusion...

 

MT4/845, Windows7/64 bit. Question about text to a new line with \n. I made a script:

#property strict

string t1="Text_1";
string t2="Text_2";

void OnStart()
  {
   Print(t1+"\n "+t2);
   Print("Text_3"+"\n Text_4");
  }

Result:


Was hoping that Text_2 and Text_4 values would be on other lines. Please advise what is wrong.

 
Konstantin Karpov:

giving identical names to code entities is an attempt to shoot oneself in the foot :)

It's easier to change the name of an input variable and you won't have any problems or confusion...

Your advice is meaningless in practice. Nobody gives identical names on purpose. The local function code lives its own separate life, while the external program lives its own life. And the names of external variables may change over time and new external variables may be added.And if after that, suddenly one of hundreds of functions hasa local variable with the same name, what do you think we should rename the global variable? You should not look for excuses for developers' bugs.
 

MT4/845, Windows7/64 bit. Script:

#property strict

double d1 = 2.009745110811111111111111111;
double d2 = 3.654;
double d3;
//---
void OnStart()
  {
   d3=d1/d2;
   Print("A: d3 = ",DoubleToString(d3));
   Print("B: d3 = ",DoubleToStr(d3));
   Print("C: d3 = ",DoubleToString(d3,16));
   Print("D: d3 = ",DoubleToString(d3,8));
   Print("E: d3 = ",DoubleToString(NormalizeDouble(d3,8)));
   Print("F: d3 = ",DoubleToString(NormalizeDouble(d3,7)));
   Print("G: d3 = ",DoubleToString(NormalizeDouble(d3,8),7));
   Print("H: d3 = ",DoubleToString(NormalizeDouble(d3,8),8));
  }
//+------------------------------------------------------------------+

Result:


Does anyone know how to print the number 0.55001234 ?

 
Maxim Khrolenko:

MT4/845, Windows7/64 bit. Script:

Result:


Does anyone know how to print the number 0.55001234 ?

 Print("C: d3 = ",DoubleToString(d3,8));

 
Maxim Khrolenko:

MT4/845, Windows7/64 bit. Question about text to a new line with \n. Made a script:

Apparently an error in MT4 (in MT5 everything is fine)
 
A100:
Apparently a bug in MT4 (MT5 is fine)
I see, hope the developers pay attention to this.
Reason: