Re: [Bluez-devel] Alignment issue

Marcel Holtmann
2005-01-20T18:14:43Z

Hi David,

> > Will it also work with other compilers?
>
> Don't know; don't care. Remember, the existing code isn't guaranteed to
> work even with gcc, let alone other compilers. Does the rest of the
> BlueZ code compile with non-gcc compilers? Probably not... you have 122
> other instances of '__attribute__((packed))' in the source. Including
> the alignment stuff in include/sdp_internal.h which does it the way I'm
> suggesting, albeit with a gratuitous '#ifdef __i386__'.

oh yes, there is other stuff that must be cleaned up.

> > What about performance? If a platform can do unaligned
> > access by itself it should be faster than compiler tricks.
>
> If the platform can do unaligned access by itself, then GCC knows that
> and emits a direct load/store instruction. It's only if the platform
> _can't_ do it by itself that GCC does anything different. That's why the
> #ifdef __i386__ in include/sdp_internal.h is pointless -- GCC should
> emit the same code even if the other version is used.

Your patch is now in (after I reworked the tab vs. space problem). And
everyone should start testing these on various platforms.

Regards

Marcel

-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl