david_navigator 12 Posted January 7, 2021 I just discovered a nasty bug in my code. During a previous debugging session I'd commented out the use of a parameter and replaced it with a hardcoded value i.e aPort replaced with 16000 procedure TAPI_Handler.ConnectDatabase(const aIPaddress: string = '192.168.42.212'; const aPort: Integer = 160000); ... ... ... FnxWinsockTransport.Port := 16000; // aPort; Surprisingly the compiler doesn't issue a hint or a warning that aPort isn't used, neither does Pascal Analyzer. Does anyone know of any third party code checking tool (maybe TMS ?) that would have picked this up ? Cheers David Share this post Link to post
Lars Fosdal 1793 Posted January 7, 2021 Aside from that aPort should be a Word to avoid invalid port values above 65535 ... TMS FixInsight supports a hint for this, though: O804 Method parameter ''Foo'' is declared but never used 1 Share this post Link to post
david_navigator 12 Posted January 7, 2021 13 minutes ago, Lars Fosdal said: Aside from that aPort should be a Word to avoid invalid port values above 65535 ... TMS FixInsight supports a hint for this, though: O804 Method parameter ''Foo'' is declared but never used Thanks.... and had I declared it as a Word, then the compiler would have picked up that I'd accidentally added an extra zero in to the default value (160000, rather than 16000) and I wouldn't have needed to debug and thus create my own bug !!! Share this post Link to post