Errors, bugs, questions - page 1204

 

Nothing is printed

string g( string str = __FUNCTION__ ) { return ( str ); }
void OnStart()
{
        Print( g() );
}

Why not?

 
marketeer:
In general, continued investigation has yielded these results. When putting the mouse cursor over the tickers in the market review, the tooltip appears, in which Trade: No. But for the Russian CFD, which are displayed in black, Trade: Close is displayed (once again it should be noted that time is trade and ticks of the symbol come at this moment). From which I conclude that the broker has several levels of prohibited trading, of which only some (or even only one) are marked in grey, and all the rest are piled in a common pile with active symbols, as they are displayed in black.

Close Only in trade type means to allow only the closing of existing positions. It is therefore shown in active black.

The modes of operation are set up on the trading server.

 
Renat:

Close Only in trade type means to allow only the closing of existing positions. This is why it is shown active in black.

The operating modes are set up on the trade server.

It does not say "Close only", but "Close". Is this an error or some other nuances remain unclear?
 
marketeer:
It doesn't say "Close only", it says "Close". Is this a mistake or are there other nuances that remain unclear?
Close here means Close Only. It is just spelled short.
 
class object_line : public CObject
{
public:
   static color line_color_befor;
};
static extern color object_line::line_color_befor = clrGreen;

void OnChartEvent(const int id,                            
                  const long& lparam,   
                  const double& dparam, 
                  const string& sparam){
   if (id == CHARTEVENT_OBJECT_CREATE)   
      Alert(object_line::line_color_befor);   
} 

1. Compiled by

2. When an object is created, the alert is clrBlack.

3. Checked on 4. 670 build

 
A100:

Nothing is printed

Why not?

Thanks for the message.
You cannot use __FUNCTION__ and __FUNCSIG__ macros outside a function body.

Added new compilation error: 377 "macro cannot appear outside of a function body".
 
ALXIMIKS:

1. Compiled by

2. When an object is created, the alert is clrBlack.

3. Checked on 4. 670 build

Thanks for the message. Error in compiler fixed, your code will compile with error:
'line_color_befor' - redefinition; different type modifiers
Use the following code to work around this error:
#include <object.mqh>

class object_line : public CObject
{
public:
   static color line_color_befor;
};

color input line_color_param=clrGreen;//object_line::line_color_befor

static color object_line::line_color_befor = line_color_param;

void OnChartEvent(const int id,                            
                  const long& lparam,   
                  const double& dparam, 
                  const string& sparam){
   if (id == CHARTEVENT_OBJECT_CREATE)   
      Alert(object_line::line_color_befor);   
} 
 
A100:

Error during execution: incorrect casting of pointers (build 977, but it happened from time to time before)

If you move something (for instance, swap declarations #import) or make 2 files instead of 3 or remove h() call - then instead of the specified errors other errors occur

If you recompose the code above, it will end up calling R::y instead of L::y

In a more complex version, some common functions from modules are called before (!) static constructors themselves (as if in the above example f() is called before X::X, which in turn is correctly called before OnStart). I will try to cite an example, but there are huge files. But sometimes it works correctly, so the error is not with me because the order of object creation is defined by the compiler itself and I cannot change it

Thanks for the post There is a problem, it is under investigation.

UPD: Fixed.
 
mql5:
Thanks for the post There's a problem, we're sorting it out.

UPD: Fixed.

I made a mistake there https://www.mql5.com/ru/forum/1111/page1221#comment_1070267, I didn't specify that functions are virtual - if now declare R and L so:

class R { public:
        virtual void y( A* a ) const { PF       ((B *)a).g( 1 ); }
};
class L : public R { public:
        virtual void y( A* a )       { PF       ((B *)a).g( 2 ); }
};
then L::y is called and R::y should be called because they are different - (different by const and the pointer was to R)
 

All brokers' terminals have stopped working, including the one I downloaded from this site...

Restarting does not help, rebooting and reinstalling too, everything was working fine before, I didn't install anything on my computer, I didn't install anything on the terminal either. only shopping in the market.

Reason: