Sometimes the "W503 Assignment right hand side is equal to its left hand side" are indeed meant to be that way, because they go through a setter and this setter triggers some hidden behaviour (like re-start a timer). It's horrible design and I saw this more than once, but the developers never document why they did it. When you try to resolve this issue, you suddenly open a can of worms, because this implicit behaviour is expected all over the place... :/
Lübbe Onken Agree, that's awful, but sometimes it makes sense (because of code in setter).
But the code I mentioned in my post is not this case. I checked it. There are no setters. In Vcl.Touch.Gestures.pas it's not even a field, they assign a method parameter(!) to itself.
Their code causes me a lot of headaches. http://qc.embarcadero.com/wc/qcmain.aspx?d=108975 "Low(string) to High(Delims)" is still in System.SysUtils.pas and the developer explicitly refused to change it. Another thing is for example http://qc.embarcadero.com/wc/qcmain.aspx?d=120954 where they use ver%s and the string 280 (XE7). Well not to forget that we have current three parsers in the product and it might get one more.
Ok, I will break my NDA - Some of the the code in the article is for the upcoming quantum computing version of Delphi - That is right! You have heard it here first - Delphi is entering the quantum computing sector! :-D
Finding possible bugs with static code analysis? How heretic! :p
ReplyDeleteYeah, really, Roman Yankovsky must be one of those guys who uses fancy SQL Databases instead of ISAM files. Ah the young 'uns! :D
ReplyDeleteAndrea Raimondi "Oh hipsters" :)
ReplyDeleteSometimes the "W503 Assignment right hand side is equal to its left hand side" are indeed meant to be that way, because they go through a setter and this setter triggers some hidden behaviour (like re-start a timer). It's horrible design and I saw this more than once, but the developers never document why they did it.
ReplyDeleteWhen you try to resolve this issue, you suddenly open a can of worms, because this implicit behaviour is expected all over the place... :/
Lübbe Onken Agree, that's awful, but sometimes it makes sense (because of code in setter).
ReplyDeleteBut the code I mentioned in my post is not this case. I checked it. There are no setters. In Vcl.Touch.Gestures.pas it's not even a field, they assign a method parameter(!) to itself.
Their code causes me a lot of headaches. http://qc.embarcadero.com/wc/qcmain.aspx?d=108975 "Low(string) to High(Delims)" is still in System.SysUtils.pas and the developer explicitly refused to change it. Another thing is for example http://qc.embarcadero.com/wc/qcmain.aspx?d=120954 where they use ver%s and the string 280 (XE7). Well not to forget that we have current three parsers in the product and it might get one more.
ReplyDeleteOk, I will break my NDA - Some of the the code in the article is for the upcoming quantum computing version of Delphi - That is right! You have heard it here first - Delphi is entering the quantum computing sector! :-D
ReplyDeleteRoman, when beta-testing FixInsight I ran it over some FMX code. You will have some things to write about in the next article :)
ReplyDeleteI like the warnings about format parameters, but this one is actually correct:
ReplyDeleteResult := Format('%0:s (WParam: %1:x (%1:d), LParam: %2:x (%2:d))',
[MsgToString(_Msg.Msg), _Msg.wParam, _Msg.LParam]);
Thomas Mueller http://fixinsight.userecho.com/topic/632351-w513-false-positive-when-using-index-specifier/
ReplyDeleteSimon Stuart You forgot "file not found" (http://thedailywtf.com/articles/What_Is_Truth_0x3f_)
ReplyDeletenext time, please do RTL. After that FMX. After that maybe some 3rd party vendors?
ReplyDeleteJeroen Wiert Pluimers I found some interesting pieces of code in RTL :) Will post it next week.
ReplyDelete