Errors, bugs, questions - page 2092

 
Renat Fatkhullin:

build 1711, the same error was observed on 1709 and 1700, I haven't noticed it before:

- if I request bar opening time which is not in the history, then CopyTime freezes for unknown time, for example I request bar opening time:

CopyTime(_ticker, _tf, _start, _stop, _buff)
где:
_ticker == RTS-9.12
_tf == PERIOD_M1
_start == D'2017.09.20 19:01'
_stop == D'2017.09.20 19:00'
_buff == динамический массив типа datetime

but because the evening session was moved to 19:05 and there are no bars in the history for this time interval, then, after calling the function, control is not transferred back to the program and it hangs.

Although, the function should exit with an error.

 

Error in execution

typedef void (*fn)();
struct A {
        fn a;
};
struct B : A {
        void a() {}
};
void OnStart()
{
        B b;
        b.a(); //error: invalid function pointer call
}
typedef void (*fn)();
void g() {}
struct A {
        A() : a( g ) {}
        fn a;
};
struct B : A {
        void a() {}
};
void OnStart()
{
        B b;
        b.a(); //вместо B::a() вызывается g()
}
 

Compilation error

typedef void (*fn)();
struct A {
        fn a;
};
struct B : A {
        void a( int ) {}
};
void OnStart()
{
        B b;
        b.a( 2 ); //error: '2' - wrong parameters count
}

 
I can't remember the static variable nuance. Can you remind me why this bastard does this?
class A
{
public:
  A()
  {
    A::f();
  }
  
  static void f()
  {
    static bool Tmp = true;
    
    Print(Tmp);
  }
};

void OnStart()
{
  static A a; // static - false, иначе - true;
}
 

Forum on trading, automated trading systems and trading strategy testing

Bugs, bugs, questions

A100, 2017.12.19 23:04

Error when executing

typedef void (*fn)();
struct A {
        fn a;
};
struct B : A {
        void a() {}
};
void OnStart()
{
        B b;
        b.a(); //error: invalid function pointer call
}
void g() {}
void OnStart()
{
        B b;
        b.a = g;
        b.a(); //вместо B::a() вызывается g()
}

Seems to be an understandable reason in both cases - field and method are the same name, so the reference to field and method are exactly the same. Correspondingly, the compiler calls the field instead of the method. In the first case, the field is not defined, so it's a bummer. In the second case, everything is okay - the field is called.

So if we declare a method in the base and a field with the same name in the descendant, it will work in a different sequence.

The compiler should give the following output

declaration of 'a' hides member declaration at line 3
 
fxsaber:

Accordingly, the compiler calls the field, not the method.

How is a field better than a method? C++, for example, calls a method rather than a field - this is logical - because the method is in a derived class, so it's closer. In other words, if the signature in the derived class fully fits, why get involved in the base class?

 
A100:

How is a field better than a method? For example C++ calls a method instead of a field, which is logical because the method is in a derived class, so it's closer. In other words, if the signature in a derived class fully fits, why get involved in the base class?

You do realise that you have created an artificial situation, which should always be accompanied by a warning from the compiler.

On the subject of "closer" I wrote

fxsaber:

if you declare a method in the base and a field with the same name in the descendant, it will work in a different sequence.

 
fxsaber:
I can't remember the nuance with static variables. Please remind me why this bastard generates this?

The whole problem is the sequence of variable initialisation and the sequence of code execution.

It's easier to understand in step-by-step debug mode than to explain in words.

 

Weird bug with freelance jobs.

there were 4 jobs in progress. i took 1 job became 5. passed one job left 5.

I took one more job and it says 5. I took one more job and it says 6. I took one more job and it says 4 jobs but it says 6 jobs are in progress.

took another job with 5 works in progress 7

now i can't take jobs although i only have 5

application number

1913868

 
Aleksei Beliakov:

Weird bug with freelance jobs.

there were 4 jobs in process. i took 1 became 5. passed one left 5.

I took one more job and it says 5. I took one more job and it says 6. I took one more job and it says 4 jobs but it says 6 jobs are in progress.

took another job with 5 works in progress 7

now i can't take jobs although i only have 5

application number

1913868

Thanks for the message, working on a fix.

Reason: