Errors, bugs, questions - page 1161

 
joo:

v4.3, custom firmware.

Main window is landscape position, other dialogs (orders) are portrait. Annoying uncontrollable switching back and forth between main window and dialogs.

come on.... not even specialised software like Smart Rotator.... helps

it's funny, but if you set landscape forcibly in Smart Rotator for the terminal, all the windows do become landscape. but i want portrait! - I set the portrait mode for the terminal, and what? - hehehe... still some windows are landscape and some are portrait.

 

A flaw in the meta-editor.

Suppose we have some function Obj() that returns a pointer to an object:

class CObject {   public:     int value; }; CObject object;

CObject* Obj() { return GetPointer(object); }

Now if we refer to the object directly through the function:Obj().value = 10, no pop-up list of class members and methods appears after entering a point.

 
meat:

The CArray class is not a panacea, given that MQL does not support class patterns. Our array does not necessarily consist of simple types, and creating a complete structure of the CArray descendant for each new class in a program is not very interesting. Just look how many lines of code each CArray descendant file takes (ArrayInt.mqh, ArrayDouble.mqh etc.)

And how the program structure is organized is of secondary importance. Let's not digress from the topic. The point is that if there is some parameter which can be changed (in this case it is reserve_size), it should be possible to get it.

Complex types are inherited from CObject and safely packaged in CArrayObj.

reserve_size - breaks the paradigm of economical programming. It exists only for beginners and must not exist in normal languages at all.

 
C-4:

reserve_size - violates the frugal programming paradigm. It exists only for beginners and should not exist at all in normal languages.

You have a strange paradigm. Reservation is precisely designed for economical use of resources, reducing the number of memory reallocations and data movement (and these are quite expensive operations). And it is a code developer who must manage this parameter, because only he knows in advance how his program will use memory. And it has nothing to do with language, because an array is an array, it requires memory everywhere.

 
meat:

This is a strange paradigm for you. Reserving is precisely designed for economical use of resources, reducing the number of memory reallocations and data transfers (and these are quite expensive operations). And it is a code developer who must manage this parameter, because only he knows in advance how his program will use memory. And it has nothing to do with language, because an array is an array as it is, it requires memory everywhere.

So you have already answered your own question:

It is a code developer who should manage this parameter, since only he knows beforehand how his program will use memory. It has nothing to do with the language at all.

It has nothing to do with language means and must therefore be solved at a higher, user level. So, solve your task with specially created for these tasks CArray* classes, which by the way, handle this task brilliantly and as if created for it.

 
meat:

You have a strange paradigm. Redundancy is precisely designed to use resources sparingly, reducing the number of memory reallocations and data transfers (which are quite costly operations)...

void TestFoo()
{
  CArrayObj listObj;
  listObj.Resize(100);
  for(int i = 0; i < 100; i++)
     listObj.Add(new CObject());
  int count = CountObj(listObj);
}

void CountObj(CArrayObj* obj)
{
   return obj.Size();
}
Super-saving code. No memory reallocations occur at all, as the number of elements is known in advance. It is not arrays which are passed but pointers to them. The speed is incredibly fast and there is no need in reserve_size. What don't you like about this solution?
 
C-4:
Super-saving code. There are no memory reallocations at all, since the number of items is known beforehand. It's not arrays that are passed but pointers to them. The speed is incredibly fast, and we don't need any reserv_size. What doesn't suit you about this solution?

Eh, if only it were that simple... In the real world, the number of elements is not usually known in advance. And what's more, this number changes dynamically. So your simplified "Hello world" example is meaningless. It can be replaced with just two lines:

CObject listObj[100];
int count = ArraySize(listObj);

Well, what's the point of all this rubbish? If you personally don't use the reserve_size parameter, you're welcome. But do not make a conclusion that everyone else is a fool or a novice. Maybe you just don't understand something. In standard STL containers, designed to work with arrays (vector, string, etc.), such methods as reserve and capacity are always present too.

 
joo:

come on.... not even specialised software like Smart Rotator.... helps

It's funny, but if I force landscape in Smart Rotator for the terminal, all windows do become landscape. but I want portrait mode! - I set the terminal to portrait mode, and what? - hehehe... still some windows are landscape and some are portrait.

works fine on stock firmware (at least as expected)
 

In the latest build the search in MetaEditor (the box in the top right corner) is no longer working properly. When I enter the word I'm looking for there, it automatically replaces it with some similar phrase, taken from somewhere I don't know where and for no reason. As a result, you cannot find anything in your code. For instance, I try to find a variable named "ERROR_VALUE" but get "error_value 7" instead.

Question: what's going on? Where does this leftover rubbish in the search line come from and how to get it out?

 
meat:

In the latest build the search in MetaEditor (the box in the top right corner) is no longer working properly. When I enter the word I'm looking for there, it automatically replaces it with some similar phrase, taken from somewhere I don't know where and for no reason. As a result, you cannot find anything in your code. For instance, I try to find a variable named "ERROR_VALUE" but get "error_value 7" in the search line instead.

Question: what's the matter? Where does this lefty rubbish in the search line come from and how to get it out?

Clean up the keyboard.