While the ::
-namespace-resolution trick has sketched a way,
the whole issue is to
principally design / refactor code adequately
to the current available & valid language-syntax rules.
There is a "fully" identical set see remark below
of functions in the New-MQL4.56789
language,
so
one may keep the code-base clean and use, with a support of compile-time directives ( may even use lexical #define
substitutions for the respective case ) but to keep the sample's structure:
class Check {
public:
static bool IsTesting() {
#ifdef __MQL5__
return( MQL5InfoInteger( MQL5_TESTER ) );
#else
return( MQLInfoInteger( MQL_TESTER ) );//_____ one could hardly find
// a better example of MetaQuotes Inc.
// practices on artificially
// injecting features not adopted MQL5
// into a stable MQL4 market
#endif
}
};
Remark
For details on how a stable language ( the MQL4
has been for about a decade )
suddenly
has lost all the code-base support
and
has experienced many syntax-creeps
for a remarkable amount of time
once a failed acceptance of a new, not yet mature product ( due to broker-side licensing issues & a bright new language concepts of MQL5
that nobody was indeed waiting for )
combined with just a marketing appetite and guess what happened,
a Grand-Slam bomb sized impact crater appeared on a global scale, which introduced an immediate must for a major re/factoring of the whole code-base, incl. DLL-interface redesign -- one may check my other posts related to this rather devastating & painfull experience on this subject
This is not a light-minded rant, it is a bloody cost, that MQL4
DevTeams had to pay for getting the same code just to run again, as it was running for years already.
Out of doubts -- a bloody lesson to remember.