Jump to content
Sign in to follow this  
Fons N

Hints on debug and release build

Recommended Posts

Hello,

 

In Delphi Pro 10.4.1 the settings about Hints are the same for debug and release. But, when building my application in debug mode I only get 1 hint. When building in release mode I get more hints. Does anyone has a clue why I don't get the same number of hints? Could it be of the optimization setting? In debug mode this is set to False. In release mode it is set to True. One of the hints I get in release mode is H2077: Value assigned to <variable name> never used. In debug mode this particular hint for that variable does not exist, but the hint does show up in release mode. Clearly, if it wasn't used than wouldn't the hint show up in debug mode also..? I can guarantee that the variable is used. Any explanation will be appreciated.

 

Best regards,

Fons 

Share this post


Link to post
Guest
procedure TForm1.FormCreate(Sender: TObject);
var
  // [dcc32 Hint] Unit1.pas(34): H2164 Variable 'abd' is declared but never used in 'TForm1.FormCreate' --- DEBUG mode
  // [dcc32 Hint] Unit1.pas(35): H2164 Variable 'abd' is declared but never used in 'TForm1.FormCreate' --- RELEASE mode
  // [dcc32 Hint] Unit1.pas(37): H2164 Variable 'efg' is declared but never used in 'TForm1.FormCreate' --- DEBUG mode
  // [dcc32 Hint] Unit1.pas(37): H2164 Variable 'efg' is declared but never used in 'TForm1.FormCreate' --- RELEASE mode
  abd: string;
  efg: integer;
begin
  ShowMessage('oi');
end;

NOTE: try "clean" your .DCU files --> Project Manager --> CLEAN option in your project! --- all dcu will be deleted and your compiled code will be re-created, and, your warning messages should re-appears!

Edited by Guest

Share this post


Link to post

Hi emailx45,

 

Thanks for helping, but unfortunately it did not change anything. In debug mode I still only get 1 hint while in release mode I get 12 hints. The CLEAN option did not remove much by the way, so I just deleted all DCU files, but with no effect to the different number of hints. I must be some setting which is different in either mode that causes this. Will try to find out what. Again, thanks for the help.

 

PS. All output is to my RAMDISK so after every boot of Windows (at least once a day) I will always start clean automatically.

 

Share this post


Link to post

To provide some more information without a complete code dump. The hint is about a local variable in a standalone procedure. The variable occurs 4 times. At 2 times it is set to zero. In 1 time it is used in an equation. The weird part is that the hint (in release mode) is on this line of code:

 

Inc(RecordTeller);

 

This is an essential line of code. And this line is run multiple times. No hint in debug mode, which is what is to be expected. I have no clue whatsoever as to why in release mode this triggers the hint H2077: Value assigned to RecordTeller never used.

 

Share this post


Link to post
Quote

But, when building my application in debug mode I only get 1 hint. When building in release mode I get more hints. 

 

DCUs are only recompiled when they are not found or a build all command is sent. Delphi may be doing this for you each time you switch from Debug to Release.

 

If they are not recompiled no hints are generated.  Allowing faster compile times 🙂

Edited by Pat Foley
typo

Share this post


Link to post
31 minutes ago, Pat Foley said:

 

DCUs are only recompiled when they are not found or a build all command is sent. Delphi may be doing this for you each time you switch from Debug to Release.

 

If they are not recompiled no hints are generated.  Allowing faster compile times 🙂

Thank. I know. But the different number of hint remain also after a complete rebuild. I am still at a loss why this is. It bugs the hell out of me...

Share this post


Link to post

Me too.    My workaround is not use default Debug Release directories.  That is import project .DPR from old D or Laz  then new D generates a well behaved .proj

 

 

Share this post


Link to post
Guest

my tip for test:

  • All compilation depend of your "Project-Option" definition (be by IDE or by file), then, try "delete your .DPROJ" file (backup it of course) to reset it.
    • it will be re-created by IDE when save or compile your project!
  • Later, compare your .DROP now, and before with "Compare Beyound" -- Edit menu!
Edited by Guest

Share this post


Link to post

Also have same issue with .DCRs  There clean removes your reg settings.  Trying your suggestion out initial 59k dropped to 9k a working import is around 11k 

Share this post


Link to post
Guest
3 hours ago, Pat Foley said:

Also have same issue with .DCRs  There clean removes your reg settings.  Trying your suggestion out initial 59k dropped to 9k a working import is around 11k 

GOOD NEWS!

remember: when all appears losted, go back to the begin and start again!

Share this post


Link to post
18 hours ago, emailx45 said:

my tip for test:

  • All compilation depend of your "Project-Option" definition (be by IDE or by file), then, try "delete your .DPROJ" file (backup it of course) to reset it.
    • it will be re-created by IDE when save or compile your project!
  • Later, compare your .DROP now, and before with "Compare Beyound" -- Edit menu!

Hi emailx45, thank you !!!  Deleting the .DPROJ file did the trick. Yes !!  As for comparing it with the old DPROJ file... which is 59K and the new one is only 8K the differences were too many, Did take a quick look and there were all kinds of references to Android and such, which I don't even have installed (neither as Delphi target platform or as an OS). But it does not matter, my problem is solved. Thanks again. Much appreciated.

Share this post


Link to post
Guest
6 hours ago, Fons N said:

Hi emailx45, thank you !!!  Deleting the .DPROJ file did the trick. Yes !!  As for comparing it with the old DPROJ file... which is 59K and the new one is only 8K the differences were too many, Did take a quick look and there were all kinds of references to Android and such, which I don't even have installed (neither as Delphi target platform or as an OS). But it does not matter, my problem is solved. Thanks again. Much appreciated.

As I always try to warn:
Faced with a new IDE, or even, when we are going to "port" a project to another IDE, I always advise to start the migration as follows:

  1. in the new IDE (or the desired one), create a new empty project;
  2. in this new project, add units / forms / etc ...
  3. make the necessary settings (mainly about "configs" and "types");
  4. make the necessary tests in the new target environment;

Anyway, this is not a law, but a sensible way to avoid many headaches, due to the standard differences between each IDE and target environment.

Certainly, Embarcadero tries, but fails to maintain full harmony between its products as something that is de facto and necessary.

  • But this is not a specific case of her.
  • Many other companies go through the same obstacles.
Edited by Guest

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×