[CLOSED] : Compiler bug with template parameter = void* - page 8

 
A100:

If I have not stated it correctly - please correct me - I have stated my concept briefly and unambiguously where warnings about brackets are needed

Incorrect. Using brackets reduces the likelihood of errors.

A warning is a message that relatively many coders make mistakes when writing this way: the result is not what they intended. This applies to all warnings, not just brackets.

 
fxsaber:

Wrong. The use of brackets reduces the chance of errors.

A warning is a message that relatively many coders make mistakes when writing in this way: the result is not what they intended. This applies to all warnings, not just brackets.

This is not a concept, but a general reasoning.

The question is of a practical character and is not of an abstract character but very concrete: where do you need parentheses? Everywhere? Or selectively? Then who determines the selection? The fxsaber? Can you formulate it unambiguously? So that this concept can be implemented in the compiler

I phrased it as: "only where it can't be done without".

 
pavlick_:

ZS: but if I did, I'd make it as similar as possible to the standard plus library (names, behaviour, etc.), so no choice for me. Why build another spec when everything is already written?

If I did, object and pointer arrays are not needed in mql at all. Dynamical lists and for each loop like for each allow solving 99% of tasks in trading in the most compact and convenient way. You don't even need a separate list class. All these extra features are needed on a larger scale than we usually have here...

 
A100: Can you articulate unambiguously?

where they make it easier to understand the code

 
TheXpert:

where they make it easier to understand the code

So that the concept can be implemented in the compiler. No one forbids unnecessary brackets. The question is about unnecessary warnings

 
A100:

The question is a practical one, not an abstract one, but a concrete one: Where are brackets needed? Everywhere? Or selectively? Then who determines the selection? The fxsaber? Can you formulate it unambiguously?

The question was if the MT4 compiler is right

Forum on trading, automated trading systems and strategy testing

New version of MetaTrader 5 build 1930 platform: Floating chart windows and .Net libraries in MQL5

fxsaber, 2018.12.11 19:44

#property strict
   // from MT5: Canvas.mqh
   uint Pixel = (r<<16|g<<8|b<<0|255<<24) &0xffffffff; //check operator precedence for possible error; use parentheses to clarify precedence


Right in this case. Brackets are not needed here, but desirable, as there is likely to be an error. It is on the basis of such probabilities that the compiler issues warnings of any kind. They were invented for a reason.

 
fxsaber:

In this case, he is right.

Specific examples are not needed at this stage (you can give as many as you like). What is needed is a single concept that can be implemented in the compiler (when warnings should be issued if brackets are missing)

 
A100:

You don't need specific examples at this stage (you can give as many as you like). What is needed is a concept that can be implemented in the compiler

It's already pretty well implemented. It's just that MT4 turned out to be smarter.

Forum on trading, automated trading systems and strategy testing

New version of MetaTrader 5 build 1930: Floating Chart Window and .Net Library in MQL5

fxsaber, 2018.12.11 20:22

These are not redundant messages at all. There are always priorities.

bool a = r && g || b; // check operator precedence for possible error; use parentheses to clarify precedence

The compiler already warns fives about a possible error as well.

 
fxsaber:

It's already pretty well implemented. It's just that MT4 turned out to be smarter.

This warning was given only because MQL5 has different priorities. Not because . ..

I.e., the concept: "Warnings are probably needed in those places where MQL4 was different before". Thus, the Developers fixed their previous mistakes. no more than that

 
It would be more convenient if the compiler offered to automatically arrange the brackets "correctly", similar to the way Excel does when you write an incomplete formula.
Reason: