-
Content Count
1428 -
Joined
-
Last visited
-
Days Won
141
Everything posted by Stefan Glienke
-
A YAML Library for Delphi
Stefan Glienke replied to Erik@Grijjy's topic in Tips / Blogs / Tutorials / Videos
Does it pass https://github.com/yaml/yaml-test-suite ? -
function _GetMem(Size: NativeInt): Pointer; begin if Size <= 0 then Exit(nil); Result := MemoryManager.GetMem(Size); if Result = nil then Error(reOutOfMemory); end; function GetMemory(Size: NativeInt): Pointer; cdecl; begin Result := MemoryManager.GetMem(Size); end; Do you see the difference? Also GetMem is an intrinsic that maps to System._GetMem
-
DCC_MapFile=3 See BDS\bin\CodeGear.Delphi.Targets starting at around line 400
-
Show public/published distinction in code-completion popup?
Stefan Glienke replied to PeterPanettone's topic in Delphi Third-Party
Writing entire words in uppercase (even more so if colored red) is considered shouting on the internet -
Show public/published distinction in code-completion popup?
Stefan Glienke replied to PeterPanettone's topic in Delphi Third-Party
That was my point - no need to shout. -
Show public/published distinction in code-completion popup?
Stefan Glienke replied to PeterPanettone's topic in Delphi Third-Party
What should it show? scnr 😉 -
Is it possible to know when a TObject is instanciated/freed?
Stefan Glienke replied to santiago's topic in General Help
uses Spring.VirtualClass; procedure NotifyFree(const Self: TObject); var freeInstance: TFreeInstance; begin freeInstance := GetClassData(Self.ClassParent).FreeInstance; Writeln('Object of class ', Self.ClassName, ' destroyed'); freeInstance(Self); end; var vc: TVirtualClasses; o: TObject; begin vc := TVirtualClasses.Create; try o := TObject.Create; try vc.Proxify(o); GetClassData(o.ClassType).FreeInstance := NotifyFree; finally o.Free; end; finally vc.Free; end; end. -
I know the repositories get maintenance and update for new Delphi releases but I wonder if there is actually a release planned. Last JCL release is 2.7 from september 2015 which probably does not support any Delphi version after that - last JVCL release is 3.49 also from september 2015. Since then we are in limbo state working with some master state - this is kinda far from optimal.
-
Anonymous methods normally don't appear in the procedure list (which I don't mind - so even if you decide to list them in the future, please make that optional). However when you have a function/procedure does not have any arguments and you don't write () they appear in the list: procedure Main; var f: TFunc<Integer>; p: TProc; f2: TFunc<Integer,Integer>; p2: TProc<Integer>; begin f := function: Integer begin end; // appears as empty entry in procedure list f := function(): Integer begin end; // does not appear p := procedure begin end; // appears as "begin end" in procedure list p := procedure() begin end; // does not appear p2 := procedure(x: Integer) begin end; // does not appear f2 := function(x: Integer): Integer begin end; // does not appear end;
-
Bug: anonymous methods in procedure list
Stefan Glienke replied to Stefan Glienke's topic in GExperts
What does QP have to do with a GExperts bug? -
Yes - all major versions can coexist
-
How do you deal with git conflict annotations added to DFM files
Stefan Glienke replied to David Schwartz's topic in General Help
Well if you are working with ignoramuses you have to get the bigger guns out and install some commit hooks to prevent them from committing unresolved conflicts. Google will help you finding out how that works. -
How do you deal with git conflict annotations added to DFM files
Stefan Glienke replied to David Schwartz's topic in General Help
Slap your coworker because he obviously did not resolve a conflict and just commited this (this is git 101). This is how git annotates the code when there is a conflict and usually you then call git mergetool (or similar) or just use the resolve conflict button in whatever git ui client you are using. Remove lines 2, 4 and 6 and decide if you want to keep 3 or 5 -
There are no false positives to this - if FastMM reports this it's true. These errors are usually very subtle and the reference to that freed instance might only live a few cycles more and unless there does not happen another memory allocation that might reuse this particular piece of memory there will never be a defect (in terms of an AV happening or something) which is why this usually goes unnoticed by most until you enable this option which is not part of the build-in FastMM version (which is a shame!). It's unbelievable how ignorant some vendors can be...
-
RTTI usage and edge cases :) Can't use GetType on T
Stefan Glienke replied to Andrea Raimondi's topic in RTL and Delphi Object Pascal
Wrong: TypeInfo(SchemaTemplate) Right: TypeInfo(T); Also fwiw making the entire method generic although you only need the typeinfo of T supports code bloat - it would be better to make it non generic and a small generic overload that just passes down the typeinfo to the non generic one. -
Get memory usage information
Stefan Glienke replied to DelphiRio's topic in RTL and Delphi Object Pascal
When you call that procedure while objects are allocated it will list them! -
Get memory usage information
Stefan Glienke replied to DelphiRio's topic in RTL and Delphi Object Pascal
Make procedure FastMM4.CheckBlocksOnShutdown(ACheckForLeakedBlocks: Boolean); accessible in the interface section and simply call it. -
Very slow access to class parameters by properties
Stefan Glienke replied to ŁukaszDe's topic in Algorithms, Data Structures and Class Design
Measure again with optimization on and stackframe off (release config) - I guess the overhead for the getter/setter calls will shrink. -
Jumping to methods via procedure list does not expand region
Stefan Glienke posted a topic in GExperts
When the method/routine being jumped to via procedure list is inside a collapsed region this region is not being expanded causing weird behavior. Same is the case for using "Previous/Next Identifier Reference" (Ctrl+Alt+Up/Down) -
Jumping to methods via procedure list does not expand region
Stefan Glienke replied to Stefan Glienke's topic in GExperts
@Larry Hengen How many open source projects do you maintain? So speak for yourself - I have received enough issue reports over the years not via bitbucket but on forums, via email or someone told me personally that I then either entered myself or just fixed (yes I need to make a habit of first reporting and then fixing so its documented outside of just a commit that says fixed xyz). It does not matter where but how and what. A poor report with zero info on bitbucket is as time consuming as a bad one elsewhere. -
ITask.Wait() behaving differently when called multiple times
Stefan Glienke replied to Der schöne Günther's topic in RTL and Delphi Object Pascal
No, because although technically not raise will free but the code running after any exception handling code unless you called AcquireExceptionObject. -
ITask.Wait() behaving differently when called multiple times
Stefan Glienke replied to Der schöne Günther's topic in RTL and Delphi Object Pascal
In 10.3 it actually raises an EAggregateException with the EProgrammerNotFound as inner exception. I guess because the exception mechanism in Delphi destroys handled exceptions they cannot be raised that easily a second time as .NET does @Dmitry Arefiev Documentation should be expanded a little though. -
Jumping to methods via procedure list does not expand region
Stefan Glienke replied to Stefan Glienke's topic in GExperts
I thought, that is what I just did... - and no, I am not creating a sourceforge account just for that. -
The Android 64bit deadline warnings have started
Stefan Glienke replied to Yaron's topic in Cross-platform
Learn how private equity firms work and you understand why things happen as they do. -
C# offtopic: Class of TSomeClass - Alternatives?
Stefan Glienke replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
https://refactoring.guru/replace-constructor-with-factory-method However I would go a step further and use delegates where you stick that implementation into. Example: You have Cat and Dog class that both derive from Animal - now because Func<T> is covariant you can write this: Func<Animal> makeAnimal = () => new Dog(); Or you can make some function that creates these Func<T> for you - then you can write: var makeCat = MakeFactory<Cat>(); // this is basically like the place in Delphi code where you would assign the TCat class to a TAnimalClass variable makeAnimal = makeCat; // again - covariant - a function returning a cat can be assigned to a func returning an animal var cat = makeAnimal(); // cat will be of type Animal though because that is the return type of makeAnimal - but that is the same for Delphi meta classes Or just use DI 😉