Errors, bugs, questions - page 2479

 
When compiling this sprint
void Func() { return(true); }

void OnStart()
{
  if (Func())
    ;
}


this log.

'if' - expression of 'void' type is illegal     Test8.mq5       5       3
empty controlled statement found        Test8.mq5       6       5
'return' - 'void' function returns a value      Test8.mq5       1       15
2 error(s), 1 warning(s)                3       2


Highlighted two errors. Is it normal that they don't go top-down in the source?

 
fxsaber:
When compiling this sprint.


this log.


Highlighted two errors. Is it normal that they don't go top-down in the source code?

Can a void function return a value?

void Func() { return(true); }
 
Alexey Viktorov:

Can a void function return a value?

The error was made specifically for the example. I was asking about something else.

 
fxsaber:

Highlighted two errors. Is it normal that they do not go from top to bottom of the source code?

Well, you can describe any function at the beginning of MQL code, as well as at the end. The compilation will be still built according to the logic of the compiler manufacturer and only the developer knows what he builds there and in what sequence.

The web is full of articles about compilers, how they build link tables and how they link...

This is a compiler, not an interpreter, right? - At the interpreter it's like a top down execution of commands or reading the source by a machine


PS: you can check that compiler doesn't include everything in byte-code, write a test code, compile it, see the size of .ex5 then add to any place (top or bottom) a lot of different functions and don't call them - the size of ex5 should not change, they were not included in ex5

 
Igor Makanu:

Well, you can describe any function at the beginning of MQL code as well as at the end. The compilation will still be built according to the logic of the compiler, and only the developer knows what he builds there and in what sequence.

The web is full of articles about compilers, how they build link tables and how they link...

This is a compiler, not an interpreter, right? - At the interpreter it's like a top down execution of commands or reading the source by a machine


PS: you can check compiler doesn't include everything in byte-code, write a test code, compile it, see the size of .ex5 then add in any place (top or bottom) a lot of different functions and don't call them - the size of ex5 must not change, they were not included in ex5

In each error there is an entry about the row and column number. It doesn't matter what form everything is in inside the compiler. It seems to have always been sorting the errors by the row number that is specified.

 
fxsaber:

It seems to have always sorted the errors by line number.

I never paid attention, I always clicked where the error was, it didn't seem to matter

 
Why is the connection with MQ-Demo lost while MQ is putting out a new beta?
 
fxsaber:
Why is the connection to MQ-Demo lost while MQ is putting out a new beta?
But it is possible to test the loss of connection to the server. It's also very good that trading - its server-side resolution - is frequently turned off/on. Also good for tests. I would also like some account parameters to be changed back and forth - it would be great for tests. For example, leverage, margin call and stop out levels, etc..
 
Artyom Trishkin:
But you can test the loss of connection to the server. It's also very good that trading - its server-side resolution - is often switched off/on. Also suitable for testing. I would also like some account parameters to be changed back and forth - it would be great for tests. For example, leverage, margin call and stop-out levels, etc.

Can you imagine how much snot there would be from those who don't need to test it? They won't understand it.

 
Artyom Trishkin:
But you can test for loss of communication with the server. It's also very good that trading - its server-side resolution - is often off/on. Also suitable for testing. I would also like some account parameters to be changed back and forth - it would be great for tests. For example, leverage, margin call and stop out levels, etc..

This can all be done via the custom tester.

Reason: