[Ffmpeg-devel] [PATCH] MingW RTSP support
Rich Felker
dalias
Sun Apr 2 03:21:20 CEST 2006
On Sat, Apr 01, 2006 at 11:32:02PM +0100, M?ns Rullg?rd wrote:
> Diego Biurrun <diego at biurrun.de> writes:
>
> > On Fri, Mar 31, 2006 at 06:46:25PM -0500, Rich Felker wrote:
> >> On Fri, Mar 31, 2006 at 01:15:59PM -0600, Michael A. Kohn wrote:
> >> > +#ifndef __MINGW32__
> >> > #include <sys/socket.h>
> >> > #include <netinet/in.h>
> >> > -#ifndef __BEOS__
> >> > -# include <arpa/inet.h>
> >> > -#else
> >> > +#include <netdb.h>
> >> > +#endif
> >> > +#ifdef __BEOS__
> >> > # include "barpainet.h"
> >> > +#elif !defined(__MINGW32__)
> >> > +# include <arpa/inet.h>
> >> > #endif
> >> > -#include <netdb.h>
> >>
> >> This stuff is still unnecessary. Just add the missing headers to your
> >> mingw.
> >
> > Why? We use #ifdef to support different platforms in many places, this
> > looks pretty normal to me...
>
> Well, it *is* pretty unreadable too...
Just because nasty hacks like this have gotten into the source before
(e.g. the BeOS crap you can see above) doesn't mean it should be
allowed to continue. If it does you end up with the nonsense in
screen's source:
#if defined(sun) && defined(LOCKPTY) && !defined(TIOCEXCL)
#if !(defined(sequent) || defined(_SEQUENT_) || defined(HAVE_SVR4_PTYS))
#if defined(MIPS) && defined(HAVE_DEV_PTC) && !defined(PTY_DONE)
#if defined(_AIX) && defined(HAVE_DEV_PTC) && !defined(PTY_DONE)
#if !defined(sun) && !defined(B43) && !defined(ISC) && !defined(pyr) && !defined(_CX_UX)
#if defined(I_PUSH) && defined(HAVE_SVR4_PTYS) && !defined(sgi) && !defined(linux) && !defined(__osf__) && !defined(M_UNIX)
#if (defined(AUX) || defined(_AUX_SOURCE)) && defined(POSIX)
#if (defined(sgi) && defined(SVR4)) || defined(__osf__) || defined(M_UNIX)
...
No only is this special-casing of operating systems completely
unreadable and unmaintainable; it also means that, when the offending
broken OS is fixed, the workarounds for the old broken version will
still be in place and the new corrected OS probably will not work!
This is completely unacceptable.
If there must be workarounds for broken operating systems in the form
of preprocessor conditions, then they need to be conditional on
individual broken features, e.g. #ifdef BROKEN_SOCKETS rather than
#ifdef __MINGW32__ or #ifdef WIN32. Then, the broken things must be
_detected_ in the configure script rather than being hard-coded, so
that if the broken OS ever fixes its noncompliance, the new fixed
version will immediately work without changing the application's build
system.
Rich
More information about the ffmpeg-devel
mailing list