On 23/11/14 22:54, Ben Hutchings wrote:
> in this function
> 
>       void copy_foo(struct foo *dst, const struct foo *src)
>       {
>               memcpy(dst, src, sizeof(*dst));
>       }
> 
> the compiler is still allowed to assume that src has the proper
> alignment for struct foo and to optimise the memcpy() accordingly.

I don't *think* lzo relies on that; the struct assignment I mentioned in
a previous mail is part of its fallback implementation of what is
basically 1-, 2-, 4- and 8-byte memcpy. The arguments seem to be
unsigned char * in practice.

liblzo2 seems to be one of these codebases that bases its idea of how C
works on portability folklore and the assumption that the compiler and
standard C library are the most naive implementation possible :-(

    S


-- 
To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/5472686e.5040...@debian.org

Reply via email to