BUG report

 

the following code can compile ok, through it miss one param.

void test()
{
    int bufid=0;
    string shortname;
    int type=1;
    int tradeType=1;
    SetIdxStyle(true, bufid, shortname, /*miss param suffix*/ type,tradeType);
}
void SetIdxStyle(bool used, int& bufid, string& shortname, string suffix, int type, int tradeType=0, bool bIndex=false, int type2=0)
{
    Print("ok");
}
 
ray:

the following code can compile ok, through it miss one param. [...]

Your SetIdxStyle() function has five compulsory parameters and three optional ones. You are passing it the minimum five parameters. Therefore the code compiles. The integer "type" parameter is implicitly treated as a string, for use as the "suffix" parameter. Like many, many languages, MQL4 doesn't complain or warn you about this sort of implicit cast. Therefore, the compiler has no grounds for seeing anything wrong in what you are doing. All it cares about is that SetIdxStyle() must be given at least five parameters, which is what is happening.
Reason: