Will MQL not support the casting of simple struct ?
https://www.mql5.com/en/docs/basis/types/casting#casting_structure
Struct casting is a basic feature in MQL, but now it does not work.
Why MQL disable this featue?
// MetaEdit: v5.0,build 1596. April 26,2017
// MT5: v5.0,build 1596. April 26,2017
// script: test_structCast.mq5
struct ID
{
int num; //4
ushort name[255];//255*2=510 SIZEOF(ID) = 514
};
struct ID2
{
ushort id[2+255];//257 *2 = 514
};
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
ID id;
id.num = 1234;
string s = "someone";
int cnt = StringToShortArray(s,id.name);
if(cnt<=0)return;
//---
ID2 id2;
id2 = (ID2)id; // Error: cannot cast "ID" to ID2
//---
}
//+------------------------------------------------------------------+