[speex-dev] minor suggestions

Daniel Vogel
Fri, 06 Aug 2004 15:01:41 -0000

I just compiled the current code in CVS with VS.NET on Windows and here are
some minor annoyances:

You might want to put the below code in a central header which is included
by every file though NOT by speex.h so including speex.h doesn't mess with
my warning levels.

#if _MSC_VER
#pragma warning(disable : 4244) /* conversion to float, possible loss of
data	*/
#pragma warning(disable : 4305) /* truncation from double to float */
#endif

The headers define structs which are then passed to the library when
using
libspeex which is a problem as different alignment restrictions will cause
problems. E.g. the default max alignment is 8 bytes with VC6/ VS.NET though
we use 4 byte which means speex.h has to ensure that the alignment matches
the alignment used to compile libspeex. The easiest approach is to do
something like:

#if SUPPORTS_PRAGMA_PACK
#pragma pack (push,8)
#endif

// all struct definitions in speex.h

#if SUPPORTS_PRAGMA_PACK
#pragma pack (pop)
#endif

And then define SUPPORTS_PRAGMA_PACK for _MSC_VER, __ICL and __GNUG__ (can't
remember whether it was 2.96 or 3.0 that added support for this pragma).

The last time I checked Ogg Vorbis had the same problem with regard to
struct packing and it is very annoying having to deal with from a developer
point of view.

-- Daniel, Epic Games Inc.

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to
'speex-dev-request@xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is
needed.
Unsubscribe messages sent to the list will be ignored/filtered.