MetaTrader 5 Platform Build 3950: Deposits/withdrawals in the terminal and updated trading report - page 3

 

Forum on trading, automated trading systems and testing trading strategies

Preprocessor regression in build 3950

yoriz, 2023.09.18 21:07

There appears to be a regression in build 3950 (14 Sep 2023) in the behavior of the preprocessor. The code below compiles without errors on the old build 3802 (9 Jun 2023):

#define NAME(prefix, linenr)     prefix##linenr
#define MAKE_VAR \
   int NAME(example, __LINE__) = 123

void OnStart() {
   MAKE_VAR;  // int example6 = 123;
   MAKE_VAR;  // int example7 = 123;
}

However, when compiling this same code in build 3950, I get an error message:

'example__LINE__' - variable already defined
   see declaration of variable '"void OnStart()"::example__LINE__'

Unfortunately, I use preprocessor concatenation ## a lot in my code so all my experts and indicators are now broken and don't compile anymore...

I filed a bug report here: https://www.mql5.com/en/forum/628/page112#comment_49409863 (because Service Desk chat-bot did not understand me and was not filing a bug)

 
Dominik Egert #:

Dont feel so pesimistic, its still beta, and probably just an unfixed bug.

How can you say that?! They force everybody to upgrade. That is not a "beta"! That is breaking all MT5's world-wide.

MetaQuotes needs to hire a professional software QA specialist. Who knows how to properly set up CI/CD pipelines, regression tests with sufficient coverage, a *voluntary* beta-test program that is not immediately pushed to all users, etc. etc.

I understand MetaQuotes does not want to maintain many different versions, so they want all users on the same version. However, they could consider having an option to downgrade to the previous version if there are bugs found by the community. If no bugs found during a month, then make the version mandatory and disable downgrade.

Alternatively, consider having a single "Long Term Support (LTS)" version that remains untouched for a year or so. After a year, use a more recent version that has been field tested for a few months as the next LTS version, etc.

 

fxsaber #:
Temporary solution.

#define ID(x) x##4##CC91BD6

Unfortunately not working for my case where I concatenate __LINE__:

#define NAME(prefix, linenr)     prefix##linenr
#define MAKE_VAR \
   int NAME(example, __LINE__) = 123

Any ideas how I can generate different variable names calling the same macro? Doesn't need to be line number so can be something else, but X+1 or X++ does not work in preprocessor of course...

P.S. __COUNTER__ is also not working. Same problem with ## operator.
 
yoriz #:

Unfortunately not working for my case where I concatenate __LINE__:

#define NAME(prefix, linenr)     prefix##linenr
#define MAKE_VAR \
   int NAME(example, __LINE__) = 123

Any ideas how I can generate different variable names calling the same macro? Doesn't need to be line number so can be something else, but X+1 or X++ does not work in preprocessor of course...

P.S. __COUNTER__ is also not working. Same problem with ## operator.
MetaQuotes is already aware about these issues. Hopefully they will fix them.
 
yoriz #:

How can you say that?! They force everybody to upgrade. That is not a "beta"! That is breaking all MT5's world-wide.

MetaQuotes needs to hire a professional software QA specialist. Who knows how to properly set up CI/CD pipelines, regression tests with sufficient coverage, a *voluntary* beta-test program that is not immediately pushed to all users, etc. etc.

I understand MetaQuotes does not want to maintain many different versions, so they want all users on the same version. However, they could consider having an option to downgrade to the previous version if there are bugs found by the community. If no bugs found during a month, then make the version mandatory and disable downgrade.

Alternatively, consider having a single "Long Term Support (LTS)" version that remains untouched for a year or so. After a year, use a more recent version that has been field tested for a few months as the next LTS version, etc.

At the time I posted, it was still beta.

I agree, life cycle Management is not the best for such a crucial software base. But other companies have similar issues.... MQ doesn't stand out in any direction, neither bad, nor good in this regard.
 

Before this latest update I could define function-like macros as follows, without issue ...

#define PositionMagicNumber() PositionGetInteger(  POSITION_MAGIC )

With this new build, this throws an error ...

too many arguments for function-like macro 'PositionMagicNumber'

To resolve it, I have to define it differently, by giving it a parameter, for example as follows ...

#define PositionMagicNumber(_)  PositionGetInteger(  POSITION_MAGIC )

This seems to contradict the way a function-like macro can be defined with an empty parameter list in C/C++. For example, the following can be found in many renditions of the standard C library stdio.h ...

#define getchar( ) getc(stdin)
 
yoriz #:

Any ideas how I can generate different variable names calling the same macro?

Unfortunately, this is not possible now.

 
Fernando Carreiro #:

Before this latest update I could define function-like macros as follows, without issue ...

Trouble with macros is not good. Why don't you use functions in this case?
long PositionMagicNumber() { return(PositionGetInteger(  POSITION_MAGIC )); }
 
fxsaber #: Trouble with macros is not good. Why don't you use functions in this case?
That was not the point of my post. My point was about the declaration of a function-like macros with an empty parameter list.
 

OMG...

I received now the latest non-Beta build 3980.

The STRATEGY TESTER panel is crazy

  • The "START" button disappeared;
  • The panel cannot be resized. The mouse is ineffective when we put it in the panel border.



But when we detach the panel, the START button suddenly appears.


It's really annoying that all releases bring bugs together.

(I work in a software development company)