[Flac-dev] Compiler warnings using gcc-4.1

Erik de Castro Lopo erikd-flac at mega-nerd.com
Tue Jan 2 13:53:17 PST 2007


Josh Coalson wrote:

> yes, I definitely want to fix them all.  the ones from memory.c
> are actually "on purpose", but if you know of a more correct and
> warning-less way to align pointers that will work for different
> pointer widths (I'm sure there must be one) please let me know.

Well for the aligned pointer allocation you can use posix_memalign
which from the Linux man page looks like:

       #define _XOPEN_SOURCE 600
       #include <stdlib.h>

       int posix_memalign(void **memptr, size_t alignment, size_t size);

    DESCRIPTION
       The function posix_memalign() allocates size bytes and places 
       the address of the allocated memory in *memptr.  The address of 
       the allocated memory will be a multiple  of  alignment, which 
       must be a power of two and a multiple of sizeof(void *).

Cheers,
Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo
+-----------------------------------------------------------+
Being really good at C++ is like being really good at using rocks to
sharpen sticks." -- Thant Tessman


More information about the Flac-dev mailing list