[vlc-devel] [PATCH] lib: fix position enumeration values
Rémi Denis-Courmont
remi at remlab.net
Tue May 20 15:26:33 CEST 2014
Le 2014-05-20 20:44, Francois Cartegnie a écrit :
> Le 20/05/2014 14:27, Mark Lee a écrit :
>
>> /* Subpicture region position flags */
>> #define SUBPICTURE_ALIGN_LEFT 0x1
>> #define SUBPICTURE_ALIGN_RIGHT 0x2
>> #define SUBPICTURE_ALIGN_TOP 0x4
>> #define SUBPICTURE_ALIGN_BOTTOM 0x8
>
> Having defines & enums is bad for consistency.
How so? libc even mixes both, e.g. so that #ifdef works.
> Maybe a best way is to split and compose enums:
>
> typedef enum libvlc_align_t {
> libvlc_align_left = 1 << 0,
> libvlc_align_right= 1 << 1,
> libvlc_align_bottom= 1 << 2,
> libvlc_align_top= 1 << 3,
> }
>
> and then compose our second enum based on those values
>
>
> typedef enum libvlc_position_t ...
> libvlc_position_left = libvlc_align_left,
> libvlc_position_top_left = ( libvlc_align_left|libvlc_align_top
> ),
That's even more confusing than either a single enum or a set of
#define's IMHO.
--
Rémi Denis-Courmont
More information about the vlc-devel
mailing list