Preprocessor regression in build 3950

 

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)

Get in touch with developers using Service Desk!
Get in touch with developers using Service Desk!
  • 2023.07.17
  • www.mql5.com
Any new software inevitably contains bugs that are not always possible to detect even under the most rigorous in-house testing...
 

There is a dedicated thread for this build: MetaTrader 5 Platform Build 3950: Deposits/withdrawals in the terminal and updated trading report

In the future, please search before posting and do so in the appropriate thread or section.

EDIT: I have placed a "pocket" reference of your post in the thread I mentioned above.

 

The issue has already been reported, so please read the following posts related to the use of the "##" combining operator in macros:

 
Fernando Carreiro #:

The issue has already been reported, so please read the following posts related to the use of the "##" combining operator in macros:

Thank you for forwarding my bug-report to the correct thread!