-
Content Count
3586 -
Joined
-
Last visited
-
Days Won
176
Everything posted by David Heffernan
-
function reference feature for Delphi source code
David Heffernan replied to Nasreddine's topic in GExperts
grep is useless for this purpose. This functionality in VS works because the tooling is able to compile the code and understand all the references from the output of that compilation. A naive text match using grep will give nothing whatsoever of value. -
Common callback functions, or not?
David Heffernan replied to Mike Torrettinni's topic in RTL and Delphi Object Pascal
No. That makes no sense. Anonymous methods are just procedural types with variable capture. -
How would RAM be wasted?
-
You don't need to call Release in Delphi code. The compiler manages that for you.
-
Random unsigned 64 bit integers
David Heffernan replied to julkas's topic in Algorithms, Data Structures and Class Design
Absolutely not. Some UInt64 values can never be returned and the performance will be poor. -
Is the missing System.TStringHelper SetChars in Chars property on purpose ?
David Heffernan replied to Rollo62's topic in RTL and Delphi Object Pascal
What will it take for Delphi programmers to give up on the idea that strings and byte arrays are the same thing! -
Random unsigned 64 bit integers
David Heffernan replied to julkas's topic in Algorithms, Data Structures and Class Design
Random returns 32 bits of randomness, why only use 16 of them? In other words, can't you do this with two calls to Random rather than four. Furthermore, Random is a pretty low grade PRNG. Depending on what you intend to use this for, you may want to use a better PRNG. -
Is the missing System.TStringHelper SetChars in Chars property on purpose ?
David Heffernan replied to Rollo62's topic in RTL and Delphi Object Pascal
These helpers are often just copied from .net, and .net strings are immutable. Here is the .net property: https://docs.microsoft.com/en-us/dotnet/api/system.string.chars?view=netcore-3.1 -
What calling convention is the function? If it is register then that is a problem. Make sure it is stdcall. A websearch for pinvoke will tell you how to call this function.
-
Range checking in library code?
David Heffernan replied to Stefan Glienke's topic in Algorithms, Data Structures and Class Design
Conceptually a list class is the same as an array. For sure it has extra convenience functionality, but it is still a random access array. So my philosophy is that consistency is achieved by having lists match arrays. I'd have the range checks conditional on RANGECHECKS. Indeed that is how I do it in my personal collection library. -
IFileOperation recursion happens when set not to
David Heffernan replied to RTollison's topic in General Help
You have to enumerate all the files and copy them. Put these files into a double null terminated list. COM should not be initialised here. It needs to be initialised by the owner of the thread. -
What is the best way to split off a new project?
David Heffernan replied to Jud's topic in General Help
I have a unit with 53kloc (hangs head in shame) -
What is the best way to split off a new project?
David Heffernan replied to Jud's topic in General Help
This is a branch or a fork in your SCM system. If you aren't using SCM then that's your problem right there. Solve that problem first. -
Organizing enums
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Don't think so https://en.cppreference.com/w/cpp/language/enum -
Organizing enums
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
That's what scoped enums are meant for -
Organizing enums
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
This is exactly the issue that scoped enums solves already. -
Organizing enums
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
That's XE7. It seems to me to be folly to design your code based on an IDE tooling issue, and especially one which is soon to be resolved. Further, the issue at stake here, as always when coding, is far less about the experience when writing code, as the experience when reading code. It's not worth it to reduce the readability of your code to give a minor easing to your experience when entering the code. -
Organizing enums
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Following on from my comment about complexity, I'm wondering what's wrong with this: You don't need to remember anything. Why are you seeking complexity here? You seem to be trying to solve a problem that simply does not exist. -
Organizing enums
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Why is that harder than remembering something else, as you seem to want to do? Why is complexity so compelling? -
Organizing enums
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
You'd be far better off using scoped enumeration. It forces you to fully qualify the enumeration. Instead of deciding what the solution is beforehand, you are better off understanding the options offered by the language and working with the language, not swimming against the tide. -
Initialization of returned managed types
David Heffernan replied to pyscripter's topic in RTL and Delphi Object Pascal
It all went downhill when Borland decided that function return values were actually var parameters. Which means that in the case of managed types they get initialized by the caller. A function return value really should have pass by value callee to caller semantics. -
Organizing enums
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
What problem are you trying to solve? What's wrong with vHTMLReportType := htTemplate; -
Simple inlined function question
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
You missed step 1. Step 1: identify the bottleneck. It's a common mistake. -
Simple inlined function question
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
All this incredible noise, and all Mike needs is to simply time his own program...... It's really so simple..... -
Simple inlined function question
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
I don't really buy what Kas is saying above. Just time your actual program is usage scenarios that you care about. After all, why would care about the performance of code that you never run? You only care about the code that you do run, or your users run.