错误、漏洞、问题 - 页 2955

 

该怎么做?数据的打包和解包不能正常工作。

这是个测试

void OnStart()
  {
   uchar my_array_in[];
   uchar my_array_out[];
   uchar my_array_test[];
   const uchar key[]= {0,0,0,0};

   for(int i1=0; i1<100; i1++)
     {
      int size=777+i1*1024+i1*3+i1;
      ArrayResize(my_array_in,size);
      for(int i2=0; i2<size; i2++)
        {
         my_array_in[i2]=uchar(i2*5956);
        }
      ResetLastError();
      int size_out=CryptEncode(CRYPT_ARCH_ZIP,my_array_in,key,my_array_out);
      if(size_out==0)
        {
         Print("CryptEncode: индекс ",i1,"   ошибка ","  ",GetLastError());
         continue;
        }
      ArrayResize(my_array_out,size_out);
      ResetLastError();
      int size_test=CryptDecode(CRYPT_ARCH_ZIP,my_array_out,key,my_array_test);
      if(size_test==0)
        {
         Print("CryptDecode: индекс ",i1,"   ошибка ","  ",GetLastError());
        }
      else
         if(size_test!=size)
           {
            Print("CryptDecode: индекс ",i1,"   не верный размер");
           }
         else
           {
            for(int i2=0; i2<size; i2++)
              {
               if(my_array_in[i2]!=my_array_test[i2])
                 {
                  Print("CryptDecode: индекс ",i1,"   ошибка в данных");
                  break;
                 }
              }
           }
     }
  }

结果。4001 意外的内部错误

2021.02.08 16:37:05.648 Test4 (EURUSD,M1)       CryptDecode: индекс 66   ошибка   4001
2021.02.08 16:37:05.649 Test4 (EURUSD,M1)       CryptDecode: индекс 68   ошибка   4001
2021.02.08 16:37:05.650 Test4 (EURUSD,M1)       CryptDecode: индекс 70   ошибка   4001
2021.02.08 16:37:05.650 Test4 (EURUSD,M1)       CryptDecode: индекс 72   ошибка   4001
2021.02.08 16:37:05.651 Test4 (EURUSD,M1)       CryptDecode: индекс 74   ошибка   4001
2021.02.08 16:37:05.652 Test4 (EURUSD,M1)       CryptDecode: индекс 76   ошибка   4001
2021.02.08 16:37:05.653 Test4 (EURUSD,M1)       CryptDecode: индекс 78   ошибка   4001
2021.02.08 16:37:05.654 Test4 (EURUSD,M1)       CryptDecode: индекс 80   ошибка   4001
2021.02.08 16:37:05.655 Test4 (EURUSD,M1)       CryptDecode: индекс 82   ошибка   4001
2021.02.08 16:37:05.656 Test4 (EURUSD,M1)       CryptDecode: индекс 84   ошибка   4001
2021.02.08 16:37:05.657 Test4 (EURUSD,M1)       CryptDecode: индекс 86   ошибка   4001
2021.02.08 16:37:05.658 Test4 (EURUSD,M1)       CryptDecode: индекс 88   ошибка   4001
2021.02.08 16:37:05.659 Test4 (EURUSD,M1)       CryptDecode: индекс 90   ошибка   4001
2021.02.08 16:37:05.660 Test4 (EURUSD,M1)       CryptDecode: индекс 92   ошибка   4001
2021.02.08 16:37:05.661 Test4 (EURUSD,M1)       CryptDecode: индекс 94   ошибка   4001
2021.02.08 16:37:05.662 Test4 (EURUSD,M1)       CryptDecode: индекс 96   ошибка   4001
2021.02.08 16:37:05.663 Test4 (EURUSD,M1)       CryptDecode: индекс 98   ошибка   4001
请开发商解决这个问题
 
DMITRII PECHERITSA:

在一般情况下,这两种方法 都不适合,因为方法是虚拟的,而且在派生类 中,方法被重写,已经被其他东西占据。

而在一些特殊情况下,你可以完全不上课

 
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"

ushort a;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   a=0;
//---
   return(INIT_SUCCEEDED);
  }


表达式不能被评估

为什么不能看到这个变量?

Открой новые возможности в MetaTrader 5 с сообществом и сервисами MQL5
Открой новые возможности в MetaTrader 5 с сообществом и сервисами MQL5
  • 2021.02.08
  • www.mql5.com
MQL5: язык торговых стратегий для MetaTrader 5, позволяет писать собственные торговые роботы, технические индикаторы, скрипты и библиотеки функций
附加的文件:
5555.png  128 kb
 
Борис Крутов:


表达式不能被评估

为什么不能看到这个变量?

我认为这是因为积极地削减了不必要的(空的、未使用的)变量。

例子。

//+------------------------------------------------------------------+
//|                                                     Expert 1.mq5 |
//|                        Copyright 2021, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
//--- input parameters
input int   Input1= 9;
//---
ushort   ushort_d = 19;
uint     uint_d   = 119;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   ushort_d=8;
   uint_d=GetTickCount();
   int d=9;
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
  }
//+------------------------------------------------------------------+

我们可以看到'ushort_d'没有被计算,也没有被使用,而'uint_d'至少被计算。


附加的文件:
Expert_1.mq5  2 kb
 

可能不在这里。

浏览论坛页面和标记已浏览的页面(将字体从粗体改为正常),在手机上的浏览器和后来在电脑上的浏览中都不能发挥作用。在手机上浏览时,后来工作正常。

在来自不同地址的计算机上,登录后一切正常。在家里看,在村里看,然后在办公室看))

在电脑上vin7、chrome。网站登录了,chrome也登录了同一个账户。

在我的手机安卓6上,使用Apex启动器和同样的chrome。该网站已登录,chrome也登录到与电脑上相同的账户。

 
Vladimir Karputov:

我认为是因为积极地削减了不必要的(空的、未使用的)变量。

例子。

我们看到'ushort_d'没有被计算,也没有被使用,而'uint_d'至少被计算。


***

它也不像那样工作。而如果我们把'ushort改为int',程序员就会看到变量

Открой новые возможности в MetaTrader 5 с сообществом и сервисами MQL5
Открой новые возможности в MetaTrader 5 с сообществом и сервисами MQL5
  • 2021.02.09
  • www.mql5.com
MQL5: язык торговых стратегий для MetaTrader 5, позволяет писать собственные торговые роботы, технические индикаторы, скрипты и библиотеки функций
 
Boris:

***

这也行不通。而如果你把ushort改为int,它就会看到变量

正确插入代码(使用按钮编码 )。

 
Vladimir Karputov:

正确插入代码(使用按钮)。

#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"



ushort=GetTickCount64();
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
a=GetTickCount64();
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
  a=a++;
  Comment("a: ",a,"/n");
}
Исправил
 
Boris:

由于有大量的错误,代码无法编译。修复代码。

 
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"



ushort a;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
a=(ushort)GetTickCount();
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
  a++;
  Comment("a: ",a,"/n");
}
Vladimir Karputov:

由于有大量的错误,代码无法编译。修复代码。

固定的是