You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
A macro and an inline function are indeed different things. But that's not what I mean. Here is an example where the arguments' values are unknown at compile time
In the first case, the code must be pasted into the current function (I suppose) and in the second case, the function is called with parameters passed through the stack (I suppose). But for the purpose of optimization, the compiler may actually implement the second variant through substitution as well. Is it so? I do not know. That's why I asked.
The ellipse object is only highlighted with the mouse if you click on the anchor points.
Is it a bug or a feature? It is very inconveniently implemented.
Это что, юмор такой чёрный?
1. Извини, - бред. Я понимаю, тут паранойя в моде, и является ломовым аргументом за "почему так не надо делать". Никакой опасности не вижу в упор. Смотрел внимательно, если чё. Любое имя, в конечном счёте есть ссылка. Индексация есть обычное расширение понятия имени. Не более. Давай запретим присваивание вообще. В целях безопасности. Ссылки же крайне опасны так?
2. Духу объектно-ориентированного программирования, при такой логике, яростно противоречат С++, С#, Делфи, пара дюжин менее популярных языков, в которых индексаторы совершенно нормально работают и справа и слева. Причём здравому смыслу и моему духу это почему-то не противоречит.
Индексаторы делаются для связи с внешней средой. Их функция именно интерфейсная. Я могу инкапсулировать и прятать что угодно, но индексы мне нужны для оперирования объектами как массивами. Фактически все массивы как-то устроены. Например обычные динамические массивы mql. Может запретим их слева от оператора присваивания ставить? Заменим функцией какой-нибудь типа SetArrayValue(array, i, j, value); Заодно и в читабельности выиграем. Да и отладка станет куда проще. Мля. Уф..
3. А как насчёт того, чтоб сделать нормальный индексатор? Горничная это конечно классно, но королева всё-таки лучше.
4. Вот в этом месте у меня крыша конкретно начала ехать. Это что, нечитабельно??
Вот это читабельнее, да?
t.setDataElement(i, i*i);
Круто. Пожалуй пойду лечиться.
5. Ваще круто.
6. Я плакаль.
e(array, i, j, value); This will also improve readability. And debugging will also become much easier. Shit. Ugh...
Well, a setter has an advantage that you can do something more than a simple equation.
For example, you can log information, convert data (if we're talking about strings or more complex data), send messages to other objects if something important happens (like update data).
How will your object know when the date has changed? Apparently you're going to store quotes...
Oh yes, that's a false problem, because your object is more like a struct and doesn't really manage anything.
Everything is done in another rubbish class, which handles everything or even worse, everything happens in onStart(), onTick(), ... ! :)
Have a nice day
3. how about making a normal indexer? maid is cool, but queen is better.
Muti gasket. Compared to a normal lvalue, however, it will be much more expensive in terms of time. But it will look just the way you need it.
______
Ah, hell no. Then you need a type ghost operator overload. Pity.
Well, the advantage of the setter is that you can do something more than a simple equation.
For example, you can log information, convert data (if we are talking about strings or more complex data), send messages to other objects if something important happens (like update data).
How will your object know when the date has changed? Apparently you're going to store quotes...
Oh yes, it's a false problem, because your object is more like struct and doesn't really control anything.
Everything is done in another rubbish class, which handles everything or even worse, everything happens in onStart(), onTick(), ... ! :)
Have a nice day
The point is that the indexer is the same as the setter in terms of features . It's implemented as a function, the contents of which can be anything (the simplest typical case is array bounds checking and handling other errors), and it's not just returning a reference to an array item.
You have a good day too.
(Sorry about yesterday's tone. I was a bit on edge - trouble at work. You had nothing to do with it. Well, unless you're being too categorical :)
Muti gasket. Compared to a normal lvalue, however, it will be much more expensive in terms of time. But it will look the way you need it.
______
Ah, hell no. You need to overload the type conversion operator then. Too bad.
Actually I think they'll do it. There's an obvious flaw with reference returns in the language.
You don't have to make reference variables, but l-value return from functions is sacred... :)
I don't think it cannot be solved in principle - the language has usual mql-arrays and they feel very well at both sides of the assignment operator. But they are C++ classes by implementation !
Here is another example from the same series. This code compiles but does not work.
My point is not that they shouldn't compile - my point is that they should work. :)
...
I'm not saying it shouldn't compile, I'm saying it should work... :)
MQL5 has a wonderful constant IS_DEBUG_MODE belonging to Other constants group. Can we add such constant for a tester? Something like IS_TESTER_MODE...
MQL5 has a wonderful constant IS_DEBUG_MODE belonging to Other constants group. Can we add such constant for a tester? Something like IS_TESTER_MODE...
Wouldn't these constants work?
ENUM_MQL5_INFO_INTEGER
Identifier
Description
Property type
MQL5_PROGRAM_TYPE
Type of mql5-program
ENUM_PROGRAM_TYPE
MQL5_DLLS_ALLOWED
Permission to use the DLL for thecurrent program running
bool
MQL5_TRADE_ALLOWED
Permissionto trade for this running program
bool
MQL5_DEBUGGING
Sign of a running program working in debug mode
bool
MQL5_TESTING
Sign of running a program in the tester
bool
MQL5_OPTIMIZATION
Sign of running a program during optimization
bool
MQL5_VISUAL_MODE
Sign of running a program in a visual testing mode
bool