pyscripter 837 Posted Friday at 10:40 PM (edited) The following gives a hint in D13: H2077 Value assigned to Test never used: function Test(Value: Integer): Integer; begin Result := -1; if Value > 0 then Result := 0 else Assert(False); end; Is the hint justified? What if Assertions are turned off? Note that in earlier versions you would get a warning if you omit the first line. Edited Friday at 10:41 PM by pyscripter Share this post Link to post
Dave Nottage 633 Posted Friday at 10:45 PM 2 minutes ago, pyscripter said: The following gives a hint in D13: H2077 Value assigned to Test never used: Not for me. 4 minutes ago, pyscripter said: What if Assertions are turned off? Did you try it with assertions turned off? Share this post Link to post
pyscripter 837 Posted Friday at 10:48 PM 2 minutes ago, Dave Nottage said: Not for me. It does not produce a hint when you target x86, but it does when you target x64. Share this post Link to post
Dave Nottage 633 Posted Friday at 10:51 PM (edited) 3 minutes ago, pyscripter said: It does not produce a hint when you target x86, but it does when you target x64. Still does not for me. EDIT: Are you using the 64-bit IDE? Edited Friday at 10:51 PM by Dave Nottage Share this post Link to post
Uwe Raabe 2201 Posted Friday at 10:53 PM I made some tests. In all cases Hints are enabled. Targets: Win32/Win64 DEBUG, Assertions on : no hint DEBUG, Assertions off : no hint RELEASE, Assertions on : hint RELEASE, Assertions off : No hint The behavior with RELEASE seems fine, but why is it different with DEBUG? Share this post Link to post
pyscripter 837 Posted Friday at 10:59 PM (edited) Actually I am getting the hint with both Win32/Win64 (32 bit IDE) and a DEBUG configuration that looks like a release configuration. The funny thing is that if I remove the offending line and disable assertions, then I get a warning about the undefined result! You can't win. Edited Friday at 11:01 PM by pyscripter Share this post Link to post
Uwe Raabe 2201 Posted Friday at 11:04 PM 3 minutes ago, pyscripter said: Actually I am getting the hint with both Win32/Win64 (32 bit IDE) and a DEBUG configuration. As I am getting just the opposite, there must be some difference with our tests. Share this post Link to post
Dave Nottage 633 Posted Friday at 11:06 PM 12 minutes ago, Uwe Raabe said: The behavior with RELEASE seems fine, but why is it different with DEBUG? Looks like the Optimization switch (off) kills the hint 1 Share this post Link to post
pyscripter 837 Posted Friday at 11:12 PM (edited) The following correctly produces the same hint, whilst in some earlier Delphi versions it wrongly produced a hint if the offending statement was omitted. function Test(Value: Integer): Integer; begin Result := -1; if Value > 0 then Result := 0 else Abort; end; Edited Friday at 11:12 PM by pyscripter Share this post Link to post
Remy Lebeau 1656 Posted Saturday at 03:32 AM 4 hours ago, pyscripter said: The following correctly produces the same hint Did they update Abort() to mark it with the new 'noreturn' attribute? Share this post Link to post
pyscripter 837 Posted Saturday at 04:41 AM 1 hour ago, Remy Lebeau said: Did they update Abort() to mark it with the new 'noreturn' attribute? Indeed. Share this post Link to post
Remy Lebeau 1656 Posted Saturday at 05:05 AM 22 minutes ago, pyscripter said: Indeed. Well, then the hint is valid since the value -1 will never be used. 2 Share this post Link to post