Sorry but your pseudo-code stands an excellent chance for being of abysmal performance. How can you be sure str2 is dword-aligned in the first place? You know how IA32 memory access degrades on non-aligned values...Curufir wrote: Because I can leverage the fact that I know the lengths to perform operations on dwords not bytes more efficiently.
I was referring to strlen() for simplicity. Sure, if you work with wide characters, you'd use wcslen(), but that's beside the point, isn't it?Since there's variable character width allowed strlen is meaningless in terms of memory allocation.
No, it would heavily break the language. The size of a char* is very much unlike the size of a char[], and how do you intend to avoid general havoc as soon as the user works with typedefs and is blissfully unaware that the uint8_t* suddenly has a sizeof() in the hundreds?It'd make far more sense to tweak sizeof to return the true size (In bytes) for a string and use that for malloc.
Ok, so it breaks the standard, but only a little ;D.
Don't touch the language. Expand it by custom headers and functions, but don't touch the language people came to expect. IMHO, of course.
I'd rather not, since that would require my dispatcher to save the SSE registers even for the most trivial of processes, instead of leaving them alone except for those processes that actually use them... (context switch times)(Ever seen your compiler use SSE for strings?).