Errors, bugs, questions - page 2645

 
Stanislav Korotky:

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

It's possible to drop all file hierarchy to sandbox without zip.

 
fxsaber:

It is possible to drop the entire file hierarchy into the sandbox without zip.

You could, but zip as an option would be required. Do you have the sources from the article https://www.mql5.com/ru/articles/1971 adapted to the latest compiler?

Работаем с ZIP-архивами средствами MQL5 без использования сторонних библиотек
Работаем с ZIP-архивами средствами MQL5 без использования сторонних библиотек
  • www.mql5.com
Однажды автора данной статьи привлекла интересная особенность функции CryptDecode, а именно — возможность распаковывать переданный ей ZIP-массив. Этот модификатор был введен разработчиками торговой платформы MetaTrader 5 для того, чтобы можно было распаковывать ответ некоторых серверов, используя стандартную функцию WebRequest. Однако из-за...
 
Stanislav Korotky:

You could, but a zip as an option would be in demand. Do you have the sources from the article https://www.mql5.com/ru/articles/1971 adapted to the latest compiler?

Yes, I use unzip. Here is a working version.

 
fxsaber:

Yes, I use unzipping. Here is a working version.

I am left with rubbish in the zipped example:

2020.02.12 21:54:06.620 ZipTask1 (EURUSD,D1)    21 leaked strings left
2020.02.12 21:54:06.620 ZipTask1 (EURUSD,D1)    21 undeleted objects left
2020.02.12 21:54:06.620 ZipTask1 (EURUSD,D1)    21 objects of type KeyValuePair left
2020.02.12 21:54:06.620 ZipTask1 (EURUSD,D1)    2184 bytes of leaked memory

Screwed to my script - same thing - seems to be in zip library.

PS. Found out it's in Dictionary.mqh

 
Stanislav Korotky:

I am left with rubbish as an example of working with zips:

Screwed to my script - same thing - seems to be in the zip library.

PS. Found out it's in Dictionary.mqh

There's a boilerplate style of code. It means I just didn't run into problems because I only used some of the functionality.

 

Why can't I make a template like this?

struct A
  {
   int               i;
   double            d;
  };

template<typename T>
T f(int value)
  {
   T result;
   return(result);
  }
//+------------------------------------------------------------------+
void OnStart()
  {
   A a;
   int i = 1;
   a = f(i);
  }
//+------------------------------------------------------------------+

template mismatch

'f' - cannot to apply template

see declaration of 'f'

'f' - parameter passed as reference, variable expected

'f' - parameter passed as reference, variable expected

 

I'm having a bit of trouble with the repository. It sends some files to the repository all right, but some won't do anything:

And most importantly, there's no mql5.storage-file in \MQL5\ folder to delete it.


Where is it now?

 
Igor Makanu:

Why can't I make a template like this?

Because you seem to have a completely wrong idea of how templates work.

   a.i = f<int>(i);

The "miracle" you wanted is not going to happen.

 
Igor Makanu:

Why can't I make a template like this?

Because the template only outputs types by parameter, not by output value.

 
fxsaber:

Because you seem to have a completely wrong idea of how templates work.

The "miracle" you wanted isn't going to happen.

how the compiler converts templates I can imagine, nothing new, it works the same way?

struct A
  {
   int               i;
   double            d;
  };

template<typename T>
void f(int value,T &result)
  {
   T tmp;
   result = tmp;
  }
//+------------------------------------------------------------------+
void OnStart()
  {
   A a;
   int i = 1;
   f(i,a);
  }
//+------------------------------------------------------------------+
Andrei Trukhanovich:

because the template only outputs types by parameters, but not by output value.

I see, I was hoping that I had overlooked something.

Ok, it's not critical, it will work via parameters

Reason: