-
Content Count
402 -
Joined
-
Last visited
-
Days Won
8
Posts posted by Kryvich
-
-
I would try to find out when used memory grows in size. After opening a certain form, or after compiling, or after starting the program, or after interrupting of execution Ctrl-F2...
Try to temporary disable third party plugins and CodeInsight features (Error insight, Help insight).
- 1
-
Final conclusion after setting of UTF-8 as a default code page for Windows: if your program actively uses ANSI strings with national characters, you cannot just recompile the program and hope that it will work correctly. You will have to carefully check the code, and use AnsiStrings with a code page (i.e. AnsiString(1251)) or RawByteStrings where appropriate.
-
@Tommi Prami Just a hope. I haven't access to the 10.4 beta.
Note: When UTF-8 is used as a default code page in Windows, if you use national characters in a AnsiChar constant, they should be encoded in #$nn format. Otherwise you'll get "W1061 Narrowing given WideChar constant (#$0401) to AnsiChar lost information".
program AnsiCharConst; {$APPTYPE CONSOLE} {$R *.res} const AnsiCharYo1: AnsiChar = 'Ё'; AnsiCharYo2: AnsiChar = #$A8; // 'Ё' in ANSI 1251 Code Page; begin Writeln('#', Byte(AnsiCharYo1), ', #', Byte(AnsiCharYo2)); Readln; end.
This program shows: "#129, #168".
- 1
-
45 minutes ago, Lars Fosdal said:This could use a QP to expose it in the regular Options dialogs.
I think this option is not necessary, if Delphi 10.4 will set UTF-8 encoding by default for all new source files.
-
56 minutes ago, Uwe Raabe said:"DefaultFileFilter"="Borland.FileFilter.UTF8ToUTF8"
It's strange that "Borland" still here in Delphi 10.3.3. 🙂
-
I have just write a little command line utility to convert your ANSI file to UTF-8.
- 1
- 1
-
-
Never seen this option. Thanks for the heads up.
P.S. Is this done to make non-Unicode programs Unicode-compatible? I think Microsoft was late with this solution for 15 years at least.
-
@TomDevOps There have been some corner cases, but I think most of them have already been fixed (for ex. https://quality.embarcadero.com/browse/RSP-23417) or will be fixed in 10.4.
- 1
-
While it's OK, I'd suggest to keep constructors as simple as possible. To prevent exceptions while an object is created.
-
Overstatic methods cannot be moved to another class.
Overstatic methods cannot be modified, only deleted completely.
Add "static; static;" to a method to protect your class from coronavirus.
P.S. In .NET it is considered an error. https://dotnetfiddle.net/dv8Rfh
-
mt.Free; mt := TFDMemTable.Create(...);
-
In Delphi 10.3.3 it's possible to write:
TStaticCheck = class class procedure OverStatic; static; static; static; static; end;
I don’t know, is it worth reporting to the issue tracker?
The idea is taken from here: System.Generics.Collections.pas, TArray.BinarySearch<T>
- 1
-
@Georgge Bakh FPC approach isn't wrong, but different.
Quote1. The compiler parses a generic, but instead of generating code it stores all tokens in a token buffer inside the PPU file.
2. The compiler parses a specialization; for this it loads the token buffer from the PPU file and parses that again. It replaces the generic parameters (in most examples "T") by the particular given type (e.g. LongInt, TObject).
The code basically appears as if the same class had been written as the generic but with T replaced by the given type.Let's experiment: will do the specialization manually as the Wiki suggests.
program ClassConstTest2; {$APPTYPE CONSOLE} {$R *.res} type TTest1 = class procedure Test(); end; TTest2 = class(TTest1) procedure Test(); end; TTestTest2 = class FTest: TTest2; procedure TestIt(); end; procedure TTestTest2.TestIt(); begin FTest := TTest2.Create(); FTest.Test(); readln; end; procedure TTest1.Test; begin Writeln('TTest1.Test'); end; procedure TTest2.Test; begin Writeln('TTest2.Test'); end; var Test2: TTestTest2; begin Test2 := TTestTest2.Create; Test2.TestIt; end.
This code outputs TTest2.Test
-
@Attila Kovacs Yes, I've found my errors. (Never programmed generics in C# before).
Updated code in C#: https://dotnetfiddle.net/010hlp
I should say it has absolutely the same behavior as Delphi's one. Perhaps Free Pascal developers understand Generics a little differently.
-
How would you write it in C#? I tried to write it like below, but it doesn't even compile:
-
I would like to see in some future version of Delphi:
- Iif operator - a magic function to write compact and effective statements of any type.
- Class contracts ("require", "ensure" clauses, https://www.elementscompiler.com/elements/oxygene/language.aspx)
- Nullable types and ":" operator, https://www.elementscompiler.com/elements/oxygene/language.aspx#colonoperator .
- "await" and "async" clauses for smooth multithreading.
- 1
-
If the topic starter get a new license of CE after every incident than OK, it's possible.
-
I have never seen a crash of my 10.3.3 CE. But I program Win 32-bit VCL mostly in it. IDE Fix Pack is installed.
13 hours ago, vhanla said:the license is still there with 360 days or more left
It's impossible. 1 year is the maximum license term for CE license.
-
-
Delphi
- Language Server Protocol for Delphi (!)
- Language Enhancements: Managed Records (after 1.5 years of waiting...)
- Unified memory management across all platforms (!)
-
Still reproducible on 10.3.3.
-
Of course HTTPServer should be "generalized" to let use it in such way.
-
@aehimself Or using generics:
TMyApplication2<T: TBaseEncoder> = class strict private _myencoder: TBaseEncoder; public constructor Create; end; constructor TMyApplication2<T>.Create; begin inherited Create; _myencoder := TBaseEncoderClass(T).Create; end; begin var MyApp1 := TMyApplication2<TBaseEncoder>.Create; Writeln(MyApp1.ClassName); var MyApp2 := TMyApplication2<TEncoderV3>.Create; Writeln(MyApp2.ClassName); end.
Boolean evaluation
in Algorithms, Data Structures and Class Design
Posted
What is Administrator? Is it a field, or a method (function)? What actual type does this field have?