[Ffmpeg-devel] [PATCH] wrong use of ff_get_fourcc in mpjg.c

Reimar Döffinger Reimar.Doeffinger
Wed Feb 7 18:53:45 CET 2007


Hello,
On Wed, Feb 07, 2007 at 05:33:33PM -0000, M?ns Rullg?rd wrote:
[...]
> That proves nothing.  Here's a proper test with gcc 4.1.1:
> 
> $ cat tag.c
> #define TAG(s) ((s)[0] | ((s)[1] << 8) | ((s)[2] << 16) | ((s)[3] << 24))
> int test = TAG("test");
> 
> int foo(int f)
> {
>     switch(f){
>     case TAG("test"):
>         return 0;
>     }
> 
>     return 1;
> }
> $ gcc -O2 -c tag.c
> tag.c:2: error: initializer element is not constant
> tag.c: In function 'foo':
> tag.c:7: error: case label does not reduce to an integer constant
> 
> The optimizer may well reduce it to a constant, but it's not a constant
> expression at the C language level.

Yes, sorry for the confusion, it can't be used in switch statements.
Leaves the question what to do with the other cases
1) leave as they are
2) use MK*TAG everywhere
3) add MK*TAGSTR that take a string and are used wherever possible

Greetings,
Reimar D?ffinger




More information about the ffmpeg-devel mailing list