confusion about the behaviour of the variables - page 4

 
wlad:
in general, I would like the developers to pay attention to

What do the developers have to do with it? Do you want them to store your variable on their server? While your computer hangs and reboots because of a power outage?
 
wlad:

test it yourself.

and you'll see what it's all about


i feel for you (((.
 

What are you talking about?

I haven't gotten any real answers yet.

the fact is there is a problem

 
Really a joint (in someone's head)
 
Vinin:
Really a joint (in someone's head)
You explain to me why this is happening.
 
It's been explained to you, you just don't want to hear other people's opinions
 
Vinin:
It's been explained to you, you just don't want to hear other people's opinions.

why

where it stands that when an external variable is changed, the global variable takes on its value

 

and only happens with thongs.

With other types, it works correctly.

tell me where I'm wrong.

 

Here is an example to compare behaviour for strings and ints

extern string ValueString = "DDD";
extern int    ValueInt    = 10;  
     
string tempString="";
int    tempInt=0;

bool   firsttime=true;
       
int start() {
   string txt=StringConcatenate( "  ValueString: ",ValueString," < >","  tempString: ",tempString,"\n",
                                 "  ValueInt: ",   ValueInt,   " < >","  tempInt: ",tempInt,"\n",
                                 "  firsttime: ",firsttime);    
   if(firsttime) {     // значение присваевается тольо ОДИН раз   
      tempString=ValueString; 
      tempInt=ValueInt; 
      firsttime=false; 
   }

   Print(txt);
   Comment(txt);                              
}

and output to the log:

1. loading EA and initiating global variables

2. transfer of external variables to global variables. one-time transfer implemented via bool firsttime

3. change of external variables

4. the difference can be seen here.

tempString takes the value of ValueString - wrong

tempInt keeps its value even though ValueInt has changed - correct

5 and 6 similar to 3 and 4


please explain why the string is behaving differently

while the Int is correct

please give me specific answers.

 
wlad:

please explain why the string behaves differently

While it's true.

I'm asking for specific answers.

I can't be very specific. I can't find the links.

I saw somewhere on the forum that when the compiler detects string variables with the same values, it puts them into the same actual memory, and references it to anyone who needs to refer to it.

So, you're probably right, they must be written in one variable. in theory, it may be an optimizer bug. write to servicedesk, send your example with the code. they will fix it.

Also duplicate here: MetaTrader 4 Build 529 beta version with new compiler has been released

--

// But in my experience I have never met a problem that could not be solved.

Reason: