[FFmpeg-devel] [PATCH 5/5] all: fix enum definition for large values
gajjanag at mit.edu
Sat Oct 24 17:18:32 CEST 2015
On Sat, Oct 24, 2015 at 11:08 AM, wm4 <nfxjfg at googlemail.com> wrote:
> On Sat, 24 Oct 2015 09:29:23 -0400
> Ganesh Ajjanagadde <gajjanagadde at gmail.com> wrote:
>> ISO C restricts enumerator values to the range of int. Thus (for instance) 0x80000000
>> unfortunately does not work, and throws a warning with -Wpedantic on
>> clang 3.7.
>> This fixes such errors by explicitly casting as an int, doing the
>> desired unsigned to signed conversion. This method works on all current
>> architectures. Tested with FATE.
> What is the point of trying to fix warnings with -Wpedantic? We don't
> even use this flag.
We don't. There are some things it shows that needed fixing (e.g the
variadic macros thing), some things which may improve readability,
some things which are highly subjective, and some things which are
As an example of the useless things that I did not bother at all with,
ISO C99 only guarantees correct handling of string literals only up to
4095 characters (C89 was ~500, forgot the number). Clang has
-Woverlength-strings for this. This is completely pointless in my
view, even though (as you can clearly tell), I fall on the more
conservative end with respect to warnings.
You may ask: why do I even bother with all this? I would like to
know/understand C better, and seeing what ISO does and does not
guarantee is educative for me. The fact that FFmpeg can (sometimes)
benefit, e.g via the variadic macros thing, is a side benefit.
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
More information about the ffmpeg-devel