A truly amazing result!!! - page 6

 
Reshetov писал(а) >>

Clive Sinclair once developed the cheap ZX-Spectrum personal computer. After the first version was sold out in large quantities, it was found out that the developers had loads of bugs in the ROM. So they made a decision to document the bugs instead of fixing them to make them fully compatible with previous versions. And the decision turned out to be right, because the bugs were later used to protect the software of this very computer from cracking.


I believe that the bug described in this thread can also be kept and used to protect Expert Advisors, i.e. to insert an incorrect condition from the point of view of logic, for example, for checking expiry date. And let those who decompile go nuts.

The discussion of this error, I hope, will motivate MQL5 developers to fix it. I will have to rewrite all programs in MQL5 anyway.

 
nen >> :

The discussion of this error will hopefully inspire MQL5 developers to fix it. I will have to rewrite all programs in MQL5 anyway.

A proof that this is an error, let's have it!

Actually a statement to the contrary:


The basic laws of Boolean algebra

Two Boolean algebra formulas are equivalent if the functions assigned to them are equal (i.e. they take the same values on all sets of argument values). Below are the basic laws of Boolean algebra that allow identical transformations of Boolean algebra formulas (note how similar they are to the laws of classical arithmetic):

  1. the law of double negation: not x = x
  2. the law of commutativity (the result does not change due to the permutation of arguments):
    x 1 or x 2 = x 2 or x 1
    x 1 and x 2 = x 2 and x 1

  3. The law of associativity (the order of calculations)
    x 1 or (x 2 or x 3 ) = (x 1 or x 2 ) or x 3
    x 1 and (x 2 and x 3 ) = (x 1 and x 2 ) and x 3

  4. the law of distributivity (opening of brackets):
    x 1 or (x 2 and x 3 ) = (x 1 or x 2 ) and (x 1 or x 3 )
    x 1 and (x 2 or x 3 ) = (x 1 and x 2 ) or (x 1 and x 3 )
  5. ...

From which it follows that from the point of view of Boolean algebra the operations or and have the same priority.

 
It's not a mistake. It's a f**king mistake.
 
TheXpert писал(а) >>

the law of distributivity (opening parentheses):
x 1 or (x 2 and x 3 ) = (x 1 or x 2 ) and (x 1 or x 3 )
x 1 and (x 2 or x 3 ) = (x 1 and x 2 ) or (x 1 and x 3 )

It follows that from the viewpoint of Boolean algebra operations and and have the same priority.

Don't be catty. Your example differs from the one that started the discussion. Take a closer look.

 
keekkenen писал(а) >>

Actually, this is not a subject for a programmer, because the specification of each language comes first and it does not matter if there are other standards somewhere...

and a single standard is a pipe dream, you know.

I think this is the most adequate idea.

Each language has its own standards. For instance, C++ and Pascal have different rules of calculating integers. In some languages, indexes start with 0, while in others they start with 1. I don't think it all matters at all.

What is important is a misinterpretation of the laws of nature, i.e. those laws which are beyond human control. And the rules and laws created by humans are the prerogative of their creators. In this case, it is only important that the laws are promulgated; in this case, the rules are published.

Let's better concentrate on the applied field:)

 

Gentlemen, on page two of this thread I gave a link and a quote from the documentation - Priorities and Order of Operations. I will give it again in a condensed form:

Attention: the priority of operations in MQL4 differs slightly from that in C.


Therefore, it is incorrect to speak of a bug.

 

I am reminded of Zadornov's humour "What is two plus two times two". A good illustration of the religious debate over priority. And in general, the topic is bearded, you could have used the site search - instead of creating a new thread.

P.S. Eh, MuruFigi the enemy, and why did you set Pak up...

 
Mathemat писал(а) >>

The topic has a beard, you could have used the site search instead of creating a new thread.

The topic will continue to be relevant. The developers seem to like it.

The next "newbie" programmer will bang his head against the subject... And everything will repeat (hee-hee).

And it does not come out of thin air.

Developers decided to retrain everyone in their own way...

It's going to be an eternal theme... Until the other end of the line gets tired of.... persist

 
Mathemat писал(а) >>

Religious debates about priority

The custom here is to make a slanted product with crooked hands growing out of %, but everyone keeps quiet because there is no other product ... or there is, but it would be better not to be ))

..

A simple example "on my own", when using if() often appears a bug - when combining && and a series of conditions >/</!=, which is very strange,

you copy the Comment() chain for review - 1, 1, 1, 1, etc - everything is OK, but if() does not "work", you make a "staircase" if() { if() { if() { ... }}}

everything works ... metacompiler glitch I think, ... and what, do the developers think they will be browbeaten and prove, ... hehe

 
Rosh писал(а) >>

Gentlemen, on page two of this thread I gave a link and a quote from the documentation - Priorities and Order of Operations. I will give it again in a condensed form:

Attention: the priority of operations in MQL4 differs slightly from that in C.

Therefore, it is incorrect to speak of a bug.

Well, I sort of agreed on the second page that if it was so, we should not speak of a bug in the compiler, but of a bug in developers' minds. No offence, I've made this thread rather for fun.

What I don't understand now is this.

What is the MQL compiler developed on? If it is developed in a normal language, the programmers must have been crazed by the fact that multiplication and addition operations have equal priority. How could they have missed it? Does everyone really put parentheses where they want and where they don't? By the way, too, too many brackets make code clearer. And when your programmers write arithmetic operations like 2+3*4 they also write 2+(3*4), or God forbid a bug may slip into a C++ compiler and nesting of 100 brackets in one expression manually count it:)

Reason: