Errors, bugs, questions - page 2163

 
Комбинатор:


I believe that you're much better at optimizations, but from the perspective of a common user it looks strange - you claim that MQL compiler generates code comparable to C++, but then it turns out that arrays in MQL aren't fast at all.

Managed/managed language clearly means that arrays must be tightly controlled. Without this, the language cannot be secure.

For static arrays, control is simpler and can be partially simplified at the code optimizer stage. For dynamic arrays there is more control and it is difficult to simplify.

The code is generated at the C++ quality level, but there is certainly an overhead in managed things. Maths, loops and everything else is at C++ level.

 
Комбинатор:

the array index is at best also reduced to a direct single assembler command, so the question still stands

In managed language only in static array with constant indexing. That is, if the optimizer is 100% sure that there is no need to check bounds and buffer availability.

If the conditions are violated, buffer presence and bounds[s] check appears.

This is basic knowledge to have when programming.

 
Vladimir Pastushak:
If an overloaded function has enumToString, there is a problem when calling it for an integer...

I've been paying attention to this https://www.mql5.com/ru/forum/1111/page1297#comment_1382986

But they didn't change anything, so ::EnumToString in templates is useless in many cases

Ошибки, баги, вопросы
Ошибки, баги, вопросы
  • 2015.02.16
  • www.mql5.com
Общее обсуждение: Ошибки, баги, вопросы
 

Continuing to explore projects and stumbling across

#resource "\\Experts\\[Project 2018]\\Expert Name\\Resources\\img\\open_buy.bmp"

resource name is too long '\Experts\[Project 2018]\Expert Name\Resources\img\open_buy.bmp' CPanel.mqh 6 1

Why do we need projects if we are limited ?

A project is PROJECT!!!!! which could have 1000 pictures, sounds, help files and we have to put everything in one folder ?

I am not a fan of mess in directories, to write a lot of quality should be in order not only in your head but also everywhere ...



 
A100:

I was paying attention to this https://www.mql5.com/ru/forum/1111/page1297#comment_1382986

But nothing was changed, so ::EnumToString in templates is useless in many cases

Hi from fxsaber:

// Для enum-ов
template <typename T>
string EnumToString2( T Value ) { return(EnumToString(Value)); }
 
// Для кастомных типов
template <typename T>
string EnumToString2( const T& ) { return(NULL); }
 
 
// Для стандартных типов
#define  ENUMTOSTRING(A) string EnumToString2( A ) { return(NULL); }
  ENUMTOSTRING(int)
  ENUMTOSTRING(string)
// .....
#undef  ENUMTOSTRING
 
#define EnumToString EnumToString2
 
template<typename T>
string ETS( T t ) { return ( typename( t ) == "int" ? "OK" : ::EnumToString( t ) ); }
enum ENUM {     ENUM__ };
 
void OnStart()
{
        ENUM i1 = ENUM__;       Print( ETS( i1 )); //нормально
        int  i2 = 0;            Print( ETS( i2 )); //"ошибка компиляции"
        string i3 = NULL;       Print( ETS( i3 )); //"ошибка компиляции"
}
 
Комбинатор:

So taking an element by index from a simple array should be a very fast operation, shouldn't it?

But non-retrieval is even faster. Somehow I noticed that if I use floating point numbers instead of integers, my program works one and a half times faster. I explained it to myself by the fact that my FPU coprocessor was mostly idle, mostly using integers. In my case you can take it into account too: SQRT is executed in FPU, ALU frees up time, they start working in parallel to a large extent.
 
Vladimir Pastushak:

Continuing to explore projects and stumbling across

#resource "\\Experts\\[Project 2018]\\Expert Name\\Resources\\img\\open_buy.bmp"

resource name is too long '\Experts\[Project 2018]\Expert Name\Resources\img\open_buy.bmp' CPanel.mqh 6 1

Why do we need projects if we are limited ?

A project is PROJECT!!!!! which can have 1000 pictures, sounds, help files and we have to put everything in one folder ?

I am not a fan of mess in directories, to write a lot of quality should be in order not only in your head but also everywhere ...

Partially correct for objects that are included at compile time and do not go into code as named objects.

The thing is that inside the EX file there is a physical limit of 64 characters for named resources.
 
Artyom Trishkin:

Hello from fxsaber:

The above code is based on a compiler flaw

void f(       int  ) { Print( 1 ); } //(1)
void f( const int& ) { Print( 2 ); } //(2)
void OnStart()
{
    int i = 0;
    f( i ); //нормально ???
}

Result: 1... and why not 2 ?

Because C++ reports an error during compilation, because both functions obviously fit and besides the current order in MQL does not allow calling function (2) explicitly at all

If this error is eliminated, the given code will become inoperable for the most part

 

Compilation error: tree optimization error

class A {
public:
    void f() {}
};
typedef A* (*fn)();
#import "Test.ex5"
    fn g();
#import
void OnStart() { g()().f(); }
 
Renat Fatkhullin:
We will partially correct for objects, which are included at compile time and do not get into the code as a named object.

The point is that there is a physical limitation of 64 characters for named resources inside the EX file.

There is very little space in product descriptions.

3600 characters is too few for large and serious programs.

I think many people will agree with me.

To describe programs you need not less than 5000 - 10000 characters. Or at least a tab with the name of the program settings

A moderator can always ask to remove the water.

Now I'm writing a program description, I used all 3600 characters only for the description of settings and didn't even describe half of the features...
Reason: