Errors, bugs, questions - page 1495

 
Karputov Vladimir:
Stop asking questions on behalf of imaginary (or fictitious) subscribers. If a subscriber has a question, let him ask it himself. Otherwise I will consider it advertising the signal.
I'm afraid you've misunderstood me. My signal has not needed advertising for a long time. I try to understand technical aspects of the service I use. Nevertheless, I am the first one to be approached.
 
Artem Prischepa:
I'm afraid you've misunderstood me. My signal hasn't needed advertising for a long time. I try to understand the technical aspects of the service I use on my own. Nevertheless, I am the first one to be approached.
In that case study the questions in theFAQ on the Signals service(first post).
 

Is it a bug or my poor understanding of the language:

void Func( int & Tmp )
{
  return;
}

void OnStart( void )
{
  int Tmp1, Tmp2;
  
  Func((0 > 1) ? Tmp1 : Tmp2); // '?' - parameter passed as reference, variable expected 
    
  return;
}
 
zaskok3:

This is a bug or my poor understanding of the language:

The result of a ternary expression is the contents of variable Tmp1 or variable Tmp2.

And the Func function should not pass the result of the expression, as you have, but a reference

 

How do I deal with this problem?

After installing the Expert Advisor on the chart that builds RENCO charts, the terminal hangs permanently.

Restarting the terminal doesn't help. I deleted the Expert from the folder - didn't help!

What to do?

win7/64 mt4/950

 
Slawa:

The result of a ternary operation expression is the contents of variable Tmp1 or variable Tmp2.

Is it the content and not the variable itself? I guess this is where my poor understanding appeared. Thank you!

I tried the ternary alternative and it didn't work:

//  Func((0 > 1) ? Tmp1 : Tmp2); // '?' - parameter passed as reference, variable expected
  
  // Так не пашет
  (0 > 1) ? Func(Tmp1) : Func(Tmp2); // 'Func' - expression of 'void' type is illegal
  
  // Так, конечно, работает
  if (0 > 1)
    Func(Tmp1);
  else
    Func(Tmp2);

Ternary here is without assignment.

 
zaskok3:

Exactly the content, not the variable itself? Apparently, this is where my poor understanding showed up. Thank you!

Tried the ternary alternative, didn't work:

Ternary here without assignment, though.

The result of a ternary operation is either the result of the first expression or the result of the second expression, depending on the result of the conditional expression.

The result must be assigned somewhere (or be a member of another expression) because it is rvalue

This is about the same as simply writing

int a=1;
int b=2;

a + b;
 

Slawa:

The result must be assigned somewhere (or be a member of another expression) because it is an rvalue

This is about the same as just writing

If I replace void Func with int Func, then it's really the same result. It's a bummer with void. Is it just because of the highlighted phrase?
 
zaskok3:
If I replace void Func with int Func, then the result is indeed the same. The void is a bummer. Is it just because of the highlighted phrase?
Yes
 
Slawa:
Yes
Got it. Thanks for the education!
Reason: