On 1/7/20 10:05 pm, Luke Small wrote: > Are you clinging to traditions for some purpose?
Are you posting random pieces of code and asking for critique on them for no apparent reason for some purpose? To be clear, this was the sum and total of your first message in this thread (excluding attachment for brevity): > I made a couple different versions if anybody is interested! > -Luke Why? Why strlcpy? Why not strcpy? Or memcpy? Why not the whole libc? Zero context. The email headers and the C source code attachment are 99% of the whole email. None of those headers start with 'References:' or 'In-Reply-To:', it was a completely detached email with no link to any existing discussion, either declared explicitly or implied by its content. Your single line message seemed like it was asking: "Am I allowed to bench-test this?" As if we have the power to stop you. Go ahead, bench-test away! As to why the stock OpenBSD implementation is written a particular way? Well, likely a big part of it is wanting the code to behave the same way in multiple scenarios, e.g. gcc vs clang, AMD64 vs ARM64 vs i386 vs mips64 vs sparc vs … you get the picture. Assembly is the "fastest" option, but requires one "implementation" for each processor architecture, and receives no benefit from improvements in optimising compilers. C means it's written *once* and ideally will perform identically for all systems, whilst also being easier to understand and maintain. If a problem is found on AMD64 for example, it's merely testing a fix already committed there on other architectures to ensure they don't break. Versus fixing it about 6 or 7 times, each time figuring out how to express the same "fix" in _that_ processor's assembly dialect. I think it naïve to assume that an implementation written to run faster on one processor architecture and compiled with one compiler will universally run faster on all other processor+compiler combinations. Anyway, I've spent more words on this than I care to. So if you don't mind, I'll be instructing my email client to ignore this thread from here on in. Regards, -- Stuart Longland (aka Redhatter, VK4MSL) I haven't lost my mind... ...it's backed up on a tape somewhere.