Errors, bugs, questions - page 2644

 
fxsaber:

Of course, there will be no differences for simple structures.

Thank you, time saved on tests


I want to implement Redis as a universal exchange of everything and between everything, but so far stuck at serialization phase, as I haven't decided if I need to serialize data for the exchange or if the volume of exchange is not so big then just strings and run everything through Redis - generally a wonderful thing, but due to the simplicity of the device of this database, all data is stored as string. Access speed to this database is very high (in-memory database).


Another question, I can't even estimate if there will be any gain in data exchange, if I serialize simple. structure into uchar[] array and serialize this array in Base64 - string... For some reason, I think that it is more efficient to convert each field of a simple structure to string and put everything in one string through a separator (the same principle as in .csv file)

 
StructToCharArray
CharArrayToStruct
 

fxsaber:

StructToCharArray

CharArrayToStruct

MQL4 does not have these functions, that's the problem

 
Igor Makanu:

MQL4 doesn't have these functions, that's the problem

Isn't it?
 
Igor Makanu:

MQL4 doesn't have these functions, that's the problem

template<typename T>
union UValue{
   T     value;
   char  array[sizeof(T)];
};

And you don't need them.

 

Who knows why the RTS-3.20 quotes on MetaQuotes-Demo have not been going since Monday?

Or is it a private fuss?

 
Artyom Trishkin:
Don't they?

is there?

... I remembered I'm the only one who knows how to search.

https://docs.mql4.com/ru/convert

https://www.mql5.com/ru/docs/convert


Vladimir Simakov:

And you don't need them

Thanks! I thought of this scenario yesterday, but didn't write it down, I'd forgotten.

I'll try it now.

 
Igor Makanu:

is there?

... I remembered I'm the only one who knows how to search.

https://docs.mql4.com/ru/convert

https://www.mql5.com/ru/docs/convert


Thanks! I thought of this scenario yesterday, but didn't write it down, I'd forgotten.

I will try it now

I wonder how I save structures in mql4 in the library then...
Described here:
Works in quadruple as well.
 
Artyom Trishkin:
I wonder how I save structures in mql4 in the library...
Described here:
Works in four as well.

I wonder why the help doesn't update? - neither online nor in ME4!

report to the top!

i checked, in MT4 build 1260 this code works correctly - same as in MQL5

#property strict
struct A
{
   long l;
   uint ui;
};
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
      A a;
      uchar u_arr[];
      string result = "";
      a.l  = 0xFFFFFFFFFFFFFFFF;
      a.ui = 0x0000;
      StructToCharArray(a,u_arr);      
      
      for(int i=0;i<ArraySize(u_arr);i++)
      {
         result += StringFormat("%x",u_arr[i]);
      }
      printf("result = %s",result);    // result = ffffffffffffffff0000
  }
//+------------------------------------------------------------------+
 
fxsaber:

So if unconditional pickup of inludes is implemented, then macros+templates won't create any problems with it, right?

Yes, all MQL-syntax will be discarded there. Fixed source compilation under new builds for now. I'll attach zip.