Clang warnings in itemrepository.h: cast from 'char *' to ... increases required alignment
Steffen Ohrendorf
steffen.ohrendorf at gmx.de
Sat Aug 3 23:49:51 UTC 2013
Am Sonntag, 4. August 2013, 01:40:19 schrieb Milian Wolff:
> Still, isn't the issue that clang warns us about here relevant? Sure, we
> don't run on ARM hardware anyways, but besides that? Should one fix
> anything here?
Aligned memory improves memory access speed as the memory controller doesn't
need to hazzle with 4-byte (on x86) or even 8-byte (x64) chunks that often.
Additionally, I think most CPUs/on-chip-caches have optimizations for aligned
memory, and even the run-time has such optimizations which might not trigger
on non-aligned memory, and chances are there that some implementations do not
check for non-aligned pointers.
A solution would be to do a memcpy at load time and let the memory manager do
a proper alignment. From your statement of a 1-to-1-memdump, this would only
affect the loading code, not the code involved in saving the data.
Cheers,
Steffen
More information about the KDevelop-devel
mailing list