A very interesting piece of research, in which I see a very familiar concept of single owners and I new concept of them providing shields for accessing the manually managed memory. I do miss mentions of Anders Hejlsberg, Chuck (Charles) Jazdzewski, or others that lay the foundation of ownership in the [WayBack] TComponent Branch.
Interesting concept of manual but safe memory management with exactly one owner of an object at any given moment and shields that prevent an object’s destruction while it’s still in use by other threads.
So the solution I came up with is to use the observation that the “array of const” is “array of TVarRec”, and that “array of TVarRec” is passed as as two arguments: a pointer to the data and the length of the array (or rather, the highest index in the array).
I’ve been using cURL but always had a feeling not to its potential basically because the cURL man page [WayBack] is both massive and lacks concrete useful practical examples.
For instance, I knew about the --header and --verbose options (I always use verbose names even though shorter -H and -v exist) to pass a specific header and get verbose output, but the man page basic examples like this by Tader:
Besides the optimised versions of these functions, I learned the most from these comments:
The DivMod should be faster. Should really be a single division. The CPU instruction will give you both div and mod from a single instruction. No point doing the divide twice.
It was back in the days when lots of new things in the Delphi world were happening: Delphi 2 – the first 32-bit version – came out half a year before and the upcoming Delphi 3 was going to be a game changer as well. New features were rock solid and sales were booming.
A while ago, I had to fix some stuff in an application that would write – using a binary mechanism – UTF-8 and UTF-16 strings (part of it XML in various flavours) to the same byte stream without converting between the two encodings.
Some links that helped me investigate what was wrong, choose what encoding to use for storage and fix it: