Download MetaTrader 5
To add comments, please log in or register
What is MetaQuotes ID? Find that out from the article!
murger
82
murger 2014.02.14 03:47 
Hi guys,
After two days works finding what was wrong....
1)

in MT4 509 I've used :

 if(atd_FixTime[u]!=iTime(0,ati_TmFram[u],0))


in V600 : that make as result : 0 !!!

the good way for V600 is now:

if(atd_FixTime[u]!=iTime(Null,ati_TmFram[u],0)) 

if help.., perhaps a bug..??


D

edit for SRC correct :-)

Ovo Cz
2955
Ovo Cz 2014.02.14 06:15  

I suppose it was NULL rather than Null.

The trouble is that NULL has two interpretations currently - the new one is acting as a pointer and the legacy one is acting as a substitute for zero. They are context dependent, so implementation may be tricky and may cause interference. There are a few more ambiguous keywords (e.g. static). I am trying to avoid the legacy ones.

Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2014.02.14 09:54  
DanielTahiti:
Hi guys,
After two days works finding what was wrong....
1)
in MT4 509 I've used : if(atd_FixTime[u]!=iTime(0,ati_TmFram[u],0)) as usual,

Please use the SRC button to post code . . .

if(atd_FixTime[u] != iTime(  0  ,ati_TmFram[u], 0))

is wrong . . . the first parameter for iTime() is string symbol not an int . . . yes I know it works in 509 but it's not correct, the Documentation clearly says to use NULL . . . "NULL means the current symbol. "

Ovo Cz
2955
Ovo Cz 2014.02.14 10:03  
RaptorUK:

Please use the SRC button to post code . . .

is wrong . . . the first parameter for iTime() is string symbol not an int . . . yes I know it works in 509 but it's not correct, the Documentation clearly says to use NULL . . . "NULL means the current symbol. "


... while some other place of the same help reads:

Constant

Description

Value





NULL

Zero for any types

0

Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2014.02.14 10:07  
Ovo:


... while some other place of the same help reads:

NULL

Zero for any types

0

This is the definition for NULL . . .

Constant Value Description
NULL0Indicates empty state of the string.


The Documentation is pretty poor in many places . . . I just hope it doesn't get worse when it gets updated.

Ovo Cz
2955
Ovo Cz 2014.02.14 10:10  
RaptorUK:

This is the definition for NULL . . .


The Documentation is pretty poor in many places . . . I just hope it doesn't get worse when it gets updated.


Yes, it is a smal change. Now the string NULL equals to "" (which is weird as well from my point of view), while former it was "0".
whroeder1
13644
whroeder1 2014.02.14 13:37  
It wasn't "0" (a string) it was zero. That meant it was trying to pass a null pointer and that was interpreted at current pair. Now it's "" which is a zero length string. Three different things.
Ovo Cz
2955
Ovo Cz 2014.02.14 15:35  
WHRoeder:
It wasn't "0" (a string) it was zero. That meant it was trying to pass a null pointer and that was interpreted at current pair. Now it's "" which is a zero length string. Three different things.


Well, no one said it was anything but zero. Try to assign a zero to a string in 509. The current pair was 0, "0", NULL - any of the three.

int start() {
        string a = NULL;
        Print(a);
}

The zero-lenght string is no Null either, therefore I said it was weird.

The third different thing I probably missed.

murger
82
murger 2014.02.14 20:01  

Thanks all for Comments,

Do you know any similar exemple of this kind of change ? what mind about the statut of " static" ?

Ovo Cz
2955
Ovo Cz 2014.02.15 06:52  
DanielTahiti:

Thanks all for Comments,

Do you know any similar exemple of this kind of change ? what mind about the statut of " static" ?





In the legacy code, the static keyword has been used for marking a variable permanent.

In the new code the static keyword is used for marking a class method or member (connected to no particular object), which is common in OOP.

So we have keywords with quite different interpretations, depending on the context they are used in.

/
To add comments, please log in or register