-
Content Count
3711 -
Joined
-
Last visited
-
Days Won
185
Everything posted by David Heffernan
-
For me the choice is between linear search and dictionary. Unless there's a natural reason for the collection to be ordered.
-
It would also be better to write a function that took the string, and returned the method to be called, to be held in a variable of procedural type. You could then have a single call to the procedure where you passed the arguments. It's very repetitious to pass the same 4 arguments to 14 separate methods.
-
Why perform 7 comparisons, on average, when you can perform 14 every time?
-
I'm using madExcept and its call stacks are fine with optimisation on.
-
The if is better. But a better comparison would be a version that converted the string to an enum. That would be more readable in the long case statement.
-
set of object instances
David Heffernan replied to dummzeuch's topic in RTL and Delphi Object Pascal
I'm not talking about a Pascal or Delphi set. I'm talking about a set in general, non language or implementation terms. And that's that the question was about. Also there are a number of libraries that define set collections that aren't native Delphi set types. I'm thinking spring4d for example. -
Custom sort of a TList with object references (works in 32 bit, does not in 64 bit)
David Heffernan replied to Alexander Halser's topic in Algorithms, Data Structures and Class Design
Sertac's question on SO covers this topic: https://stackoverflow.com/questions/10162749/why-cannot-take-address-to-a-nested-local-function-in-64-bit-delphi -
set of object instances
David Heffernan replied to dummzeuch's topic in RTL and Delphi Object Pascal
What you've described is a set. So that's why he keeps thinking of it as a set. -
Why Should a C-Sharper Learn Delphi?
David Heffernan replied to Qasim Shahzad's topic in General Help
There must be lots of other ways to do this that use more mainstream languages- 14 replies
-
One thing you could easily do would be to always output the db instructions, but put the asm in comments, then it would be just as readable, but have no ifdefs
-
set of object instances
David Heffernan replied to dummzeuch's topic in RTL and Delphi Object Pascal
All these people suggesting TList (i.e. an array) are just asking for performance problems if ever the collection has a significant size. -
The standard approach is to decide what encoding to use internally. And then convert between that encoding and any other encoding when the data initially enters your program, or at the last moment before it leaves. Given that the native encoding of the frameworks that C++ Builder supports is utf16, that is the obvious choice for the internal encoding. And then you can use TEncoding to perform all other conversions. Why are you wanting to go low level to C runtime and Win32? Why don't you use the frameworks provided.
-
I think I'd extend the tool to produce cleaner output
-
Not really relevant since making software this way would breach the license.
-
Why Should a C-Sharper Learn Delphi?
David Heffernan replied to Qasim Shahzad's topic in General Help
I don't know about FPC, but FPC is just a pascal compiler. You are asking about libraries. And I certainly don't know anything about them.- 14 replies
-
Why Should a C-Sharper Learn Delphi?
David Heffernan replied to Qasim Shahzad's topic in General Help
It depends what native is important. FMX doesn't use native GUI widgets and toolkits. But it's native in the sense that the compiler emits code that runs on the metal. To me it feels like the former is an important limitation and the latter is just not relevant.- 14 replies
-
Why Should a C-Sharper Learn Delphi?
David Heffernan replied to Qasim Shahzad's topic in General Help
Can you? You can with VCL but FMX isn't native. Is that really a significant advantage over C#?- 14 replies
-
If it's a char* then no. But if you held the data in a type that also had an encoding then the rtl would convert. Why not convert to utf16 as early as possible though?
-
Where is the UTF8 text coming from?
-
set of object instances
David Heffernan replied to dummzeuch's topic in RTL and Delphi Object Pascal
Yes they did -
set of object instances
David Heffernan replied to dummzeuch's topic in RTL and Delphi Object Pascal
Doesn't handle duplicates -
set of object instances
David Heffernan replied to dummzeuch's topic in RTL and Delphi Object Pascal
Spring has a collection that meets your needs. With pure rtl you can fake it with a geneic dictionary. -
Local variables broken when debugging .obj files?
David Heffernan replied to terran's topic in General Help
If I were you I'd compile the code into a DLL and link to that. My experience is that works more reliably. I used to do the .obj dance back in the day but moved away from it. Very happy to have done so. -
Local variables broken when debugging .obj files?
David Heffernan replied to terran's topic in General Help
I didn't even know that Delphi debugger would step into obj files. How did you compile the .obj file? Where is Delphi getting the debug info from? -
I don't really understand this either. I think @PeterBelow was just stating this clearly, and did a good job of it.