Download MetaTrader 5

Code breaking changes in MQL4 language

To add comments, please log in or register
Dobrynya Komarov
999
Dobrynya Komarov  

Hi, guys!

I already got accustomed to surprises with every new version of the MT4 platform, but this one is really frustrating:

struct Util_32bytes { uchar data[32]; };
struct Util_4ulongs { ulong data[4];  };

Util_32bytes raw;
Util_4ulongs long4 = raw;

This code should work according to the documentation, and it did.

But it (suddenly) stopped working after the latest update to MT4 (1080, I suppose). Typecast will not work either.

What the heck?! It will break a lot of code! And how to assign structures now?

Dobrynya Komarov
999
Dobrynya Komarov  

Reading other topics I came to conclusion that the 1080 build is screwed up. When do you plan to fix all those issues?

fxsaber
6196
fxsaber  
https://www.mql5.com/en/forum/192414#comment_5026943
Struct Casting Error
Struct Casting Error
  • 2017.05.12
  • www.mql5.com
Will MQL not support the casting of simple struct ? https://www.mql5...
whroeder1
15321
whroeder1  
Dobrynya Komarov: When do you plan to fix all those issues?
This is a user's forum not Metaquotes. We're not going to fix anything.
Dobrynya Komarov
999
Dobrynya Komarov  
fxsaber:
https://www.mql5.com/en/forum/192414#comment_5026943


Thanks a lot! Tried to Google it with no luck.

Dobrynya Komarov
999
Dobrynya Komarov  
whroeder1:
This is a user's forum not Metaquotes. We're not going to fix anything.

What a pity. I'd like to talk to designers of this "language". :-D
Alain Verleyen
Moderator
32012
Alain Verleyen  
Dobrynya Komarov:

Reading other topics I came to conclusion that the 1080 build is screwed up. When do you plan to fix all those issues?

It's not a bug it's a feature so don't expect a fix.

They introduced union (not documented on MT4, but works well with ME 1599) :

union Udata_32bytes 
  {
   uchar             d_uchar[32];
   ulong             d_ulong[4];
  }
data;

void OnStart()
  {
   data.d_ulong[0]=0xFFEEDDCC;
   
   printf("uchar[%i] = %X",1,data.d_uchar[1]);

  }
Dobrynya Komarov
999
Dobrynya Komarov  
Alain Verleyen:

It's not a bug it's a feature so don't expect a fix.

They introduced union (not documented on MT4, but works well with ME 1599) :


Yeah, thanks, I already got that. 

Nice to know that they can remove any arbitrary feature from their "language" and introduce some other at any time without any notice and any documentation. :))

Alain Verleyen
Moderator
32012
Alain Verleyen  
Dobrynya Komarov:

Nice to know that they can remove any arbitrary feature from their "language" and introduce some other at any time without any notice and any documentation. :))

Exactly, that's amazing.

As I understood, for Metaquotes, the forum is an extension of the documentation.
To add comments, please log in or register