[FFmpeg-devel] [PATCH][RFC] -std=c99

Måns Rullgård mans
Tue Aug 12 21:56:12 CEST 2008


Michael Niedermayer <michaelni at gmx.at> writes:

> Hi
>
> the patch below adds -std=c99 to the cflags when supported.
> The advanatges this has is that the compiler uses C99 semantics,
> that several non C99 features and declarations become disabled by default
> and thus cannot so easily be used mistakely.
>
> Compilation and regression tests pass for me.
>
> -fasm is needed for
>     asm()
>
> -D_BSD_SOURCE is needed for
>     strncasecmp()
>     inet_aton()
>     gethostname()
>     fd_set()
>     FD_ZERO
>     FD_SET
>     FD_ISSET
>
> -D_POSIX_C_SOURCE is needed for:
>     getaddrinfo()
>     gai_strerror()
>     freeaddrinfo()
>     AI_PASSIVE
>     getnameinfo()
>
> -D_POSIX_C_SOURCE=2 is needed for:
>     optind
>     optarg
>     getopt()
>
> The defines are likely  needed for more than what i have listed above,
> these where just amongth the first that showed up without the specfic option

Something like this has been on my low-priority TODO list (i.e. things
that I'd like to do, but probably never will) for some time.

_POSIX_C_SOURCE and _XOPEN_SOURCE are standard feature selection
macros, so using those is preferred over the glibc-specific ones.
Setting _BSD_SOURCE is slightly dangerous, since it makes glibc
replace a few standard functions with BSD-compatible functions of the
same name.

Most (all?) of the above-mentioned functions are POSIX standard, so
there should be no need for _BSD_SOURCE.  If anything does require
this, we should look for a POSIX alternative.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list