-
Content Count
402 -
Joined
-
Last visited
-
Days Won
8
Posts posted by Kryvich
-
-
In 2018, a special edition of Fast Report was included in the package with the Delphi Community. Now you need to buy Fast Report yourself, or buy the Delphi Professional with Fast Report Embarcadero RAD Edition included.
-
6 minutes ago, Fr0sT.Brutal said:Bad practice that Delphi RTL started itself. If usual clause is not applicable for some reason, why not write "raise CreateInternalError(...)"? Mystery for me
Definitely it would look better and not generate tons of compiler warnings in Delphi. They grab this practice from FPC. See pasresolver.pp, there are procedures like RaiseMsg, RaiseNotYetImplemented, RaiseInternalError, RaiseInvalidScopeForElement. All of them can be replaced with custom exceptions.
-
44 minutes ago, Uwe Raabe said:Agree. I prefer Pascal Analyzer to get notified about problems like the one this thread is all about. In contrast to the compiler, eliminating all warnings from Pascal Analyzer is not the goal. If I don't want to get notified the next time I can suppress it with a simple comment.
I tried the TestInitialization project with Pascal Analyzer Lite, but it doesn't see a problem with using an uninitialized var parameter either. Perhaps the full paid version will determine this issue.
-
2 minutes ago, Attila Kovacs said:as I mentioned before, to avoid the hints you have to act so you could make it an error instead of a hint
or are you the guy who having 2 kilometer of hints after a build?
I try to never allow hints or warnings in the release code.
Right now I am adapting the latest version of the PAS2JS transpiler for Delphi. I see dozens of warnings that Delphi shows. Most of them are false positive, such as an undefined function return value (W1035) after an exception is generated (RaiseInternalError(...);). But some potentially problematic places went unnoticed by the PAS2JS developers. Also, a lot of warnings are generated due to the different internal representation of strings in Free Pascal (UTF8) and Delphi (Unicodestring). I carefully study all warnings and correct the code.
-
26 minutes ago, Attila Kovacs said:that won't help much as out parameter also taking inputs without any warnings, which is more screwed as the original problem
The compiler should generate absolutely the same code for var and out parameters, both for the calling and for the called subroutines. The only difference will be in the warnings it issues:
Warning var parameter out parameter Where to show 1. W1036 Variable might not have been initialized yes no Calling routine 2. The parameter must be initialized before use no yes Called routine 3. Return value of parameter might be undefined no yes Called routine
Warnings 2. and 3. should work in the same way as for the Return value of a function (W1035 Return value of function might be undefined). That is, all the necessary checks (W1035, W1036) are already in the compiler, Embarcadero only has to apply them to the parameters where necessary.
-
18 hours ago, Attila Kovacs said:It's not the compilers job to do code analysis for you?
Checking the initialization of var parameters before use is a basic thing that does not require deep analysis. In fact, it has already implemented for parameters passed by value.
procedure Test; procedure DoStuff({var} a: Integer); begin if a = 0 then a := 1; end; var a: Integer; begin DoStuff(a); // W1036 Variable 'a' might not have been initialized Writeln(a); end;
-
13 hours ago, Dalija Prasnikar said:But, Delphi out parameters have some unpleasantries and many developers choose to use var instead.
https://delphisorcery.blogspot.com/2021/04/out-parameters-are-just-bad-var.html
Good article. The main point against using the out parameter in Delphi is sub-optimal generated code, due to the need to maintain compatibility with C++ Builder.
But how often is Delphi code used in C++? Maybe a better solution would be to add additional checks and parameter initializations to the calling C++ code?
-
The FPC compiler shows a hint like this in this case:
Hint: Local variable "a" does not seem to be initialized
But I'm sure this should be a warning, not a hint.
-
I created a minimal reproducible example for this case.
program TestInitialization; {$APPTYPE CONSOLE} procedure Test; procedure DoStuff(var a: Integer); begin if a = 0 then a := 1; end; var a: Integer; begin DoStuff(a); Writeln(a); end; begin Test; Readln; end.
It's strange that the compiler doesn't show a warning W1036 Variable 'a' might not have been initialized. This is definitely an oversight.
- 1
-
What is the working language for communications in your company? English, Russian?
- 1
-
I see that HelpNDoc can generate various types of help files, including HTML and CHM. Can the generated files be used as context help in Delphi programs via TControl.HelpKeyword and/or TControl.HelpContext?
-
Waiting for the IDE update is not a best strategy. If you plan to update your development environment, you should prepare your code for the High DPI.
-
7 minutes ago, Alexander Elagin said:A redundant begin/end block around a single Continue
The code can be further simplified:
if Utc.IsZero then Continue; _UtcValid := Utc; ...
- 2
-
High DPI is a big step forward in Windows development. Like the transition to Unicode, it may require a careful study of the codebase, fixing custom rendering of forms, updating third party components. This will not be automatically fixed with a new patch of IDE.
-
Try temporarily turn off Display Scaling in Windows.
-
Add using unitA from unitB?
-
is the third argument optional?
-
I don't expect much from the new version, but a properly implemented iif statement would improve my code here and now.
-
54 minutes ago, John Kouraklis said:Unless you have only Win apps and things like Win utils, FMX or more correctly cross-platform is the only way to go.
Not only. How about CrossVCL? They support Linux and OSX, and plan to support Android and iOS in 2021.
-
-
If a single-exe project is some command line utility, which is called very often, the size matters. I'd prefer if RTTI will be disabled by default, and it could be enabled for types where it really needed.
-
I would like to have a compiler option to disable modern RTTI throughout the application, including the linked standard library. Glad to hear that you managed to disable this information in your project.
- 1
-
According to the probability theory, there is a 1/19 770 609 664 chance that on the next try you will get the desired 6-letter word. So the fact that after 400 billion attempts it has not been received looks suspicious, but not impossible. (19 770 609 664 = 52*52*52*52*52*52).
By the way, here are the probabilities of finding a word with fewer characters:
1-letter word: 1/52,
2-letter word: 1/2 704,
3-letter word: 1/140 608,
4-letter word: 1/7 311 616,
5-letter word: 1/380 204 032,
6-letter word: 1/19 770 609 664.
- 1
-
@emailx45 Yes, I can reproduce in VirtualBox 6.1 with Windows 10 and Delphi 10.4.2 installed.
Error: Invalid Class Typecast. Details:
Quote[21386672]{vclide270.bpl} GDIPlus.GradientTabs.TGradientButton.FormDPI (Line 358, "GDIPlus.GradientTabs.pas" + 1) + $F
[5005A496]{rtl270.bpl } System.ErrorAt (Line 5781, "System.pas" + 3) + $4
[5005FFD3]{rtl270.bpl } System.@AsClass (Line 18460, "System.pas" + 3) + $5
[21386672]{vclide270.bpl} GDIPlus.GradientTabs.TGradientButton.FormDPI (Line 358, "GDIPlus.GradientTabs.pas" + 1) + $F
[21386BC6]{vclide270.bpl} GDIPlus.GradientTabs.TScrollerButton.PaintLeftArrow (Line 520, "GDIPlus.GradientTabs.pas" + 3) + $2
[21386B85]{vclide270.bpl} GDIPlus.GradientTabs.TScrollerButton.Paint (Line 508, "GDIPlus.GradientTabs.pas" + 3) + $2
[50D01E19]{vcl270.bpl } Vcl.Controls.TGraphicControl.WMPaint (Line 14009, "Vcl.Controls.pas" + 7) + $5
[50CF7172]{vcl270.bpl } Vcl.Controls.TControl.WndProc (Line 7480, "Vcl.Controls.pas" + 91) + $6
[50CF6DAC]{vcl270.bpl } Vcl.Controls.TControl.Perform (Line 7258, "Vcl.Controls.pas" + 10) + $8
[50CFC56E]{vcl270.bpl } Vcl.Controls.TWinControl.PaintControls (Line 10582, "Vcl.Controls.pas" + 27) + $D
[50CFC36B]{vcl270.bpl } Vcl.Controls.TWinControl.PaintHandler (Line 10528, "Vcl.Controls.pas" + 24) + $8
[50CFCBF4]{vcl270.bpl } Vcl.Controls.TWinControl.WMPaint (Line 10711, "Vcl.Controls.pas" + 6) + $5
[50D02BC1]{vcl270.bpl } Vcl.Controls.TCustomControl.WMPaint (Line 14385, "Vcl.Controls.pas" + 2) + $4
[50CF7172]{vcl270.bpl } Vcl.Controls.TControl.WndProc (Line 7480, "Vcl.Controls.pas" + 91) + $6
[50CF8C36]{vcl270.bpl } Vcl.Controls.TControl.GetStyleName (Line 8510, "Vcl.Controls.pas" + 1) + $8
[50CF8C56]{vcl270.bpl } Vcl.Controls.TControl.GetStyleName (Line 8512, "Vcl.Controls.pas" + 3) + $7
[5005A240]{rtl270.bpl } System.@GetMem (Line 4843, "System.pas" + 20) + $0
[50061E56]{rtl270.bpl } System.@NewUnicodeString (Line 25659, "System.pas" + 10) + $0
[500622F1]{rtl270.bpl } System.@UStrAsg (Line 26649, "System.pas" + 19) + $0
[5005A25C]{rtl270.bpl } System.@FreeMem (Line 4891, "System.pas" + 20) + $0
[50061F75]{rtl270.bpl } System.@UStrArrayClr (Line 26028, "System.pas" + 16) + $0
[50CF8D13]{vcl270.bpl } Vcl.Controls.TControl.IsCustomStyleActive (Line 8526, "Vcl.Controls.pas" + 😎 + $15
[50CFC0C7]{vcl270.bpl } Vcl.Controls.TWinControl.WndProc (Line 10424, "Vcl.Controls.pas" + 169) + $6
[50CFB614]{vcl270.bpl } Vcl.Controls.TWinControl.MainWndProc (Line 10113, "Vcl.Controls.pas" + 3) + $6
[501826A4]{rtl270.bpl } System.Classes.StdWndProc (Line 18175, "System.Classes.pas" + 😎 + $0
[50E5C233]{vcl270.bpl } Vcl.Forms.TApplication.ProcessMessage (Line 11028, "Vcl.Forms.pas" + 23) + $1
[50E5C276]{vcl270.bpl } Vcl.Forms.TApplication.HandleMessage (Line 11058, "Vcl.Forms.pas" + 1) + $4
[50E5C5AD]{vcl270.bpl } Vcl.Forms.TApplication.Run (Line 11196, "Vcl.Forms.pas" + 26) + $3
[00524DB8]{bds.exe } bds.bds (Line 222, "" + 13) + $2Though I never used this view in modern IDEs. Palette Tool window is more convenient on modern wide displays.
Getting up to speed with TRestClient and the other components
in Network, Cloud and Web
Posted
There are several free and opensource REST libraries available so you don't have to start from scratch. I would recommend
See example applications to a specific framework.