Skip to contentSkip to conversation

Video4Linux header files (and unnamed unions)

DISCUSSION Hans Petter Selasky 1 participant 1 message Oct 8, 2008 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hi,

Would you accept the following patch to the videodev2.h file, that all unnamed unions are appended "MY_UNION" or something like that?

--HPS

---------- Forwarded Message ----------

Quoted 12 lines · Luigi Rizzo
Quoted 1 line · Hans Petter Selasky

On Saturday 19 May 2007 21:14, Luigi Rizzo wrote:

...

Quoted 7 lines
Quoted 6 lines

- i don't know how problematic is this, but v4l2 headers seem to use unnamed unions which, last time i tried, conflict with the compiler setting used to build the kernel. While this is possibly an
orthogonal problem which we may have to address at some point (as unnamed unions seem to be a common paradigm in linux headers), it is yet another hurdle.

Quoted 2 lines
Quoted 2 lines

Unnamed unions are not so good. I suggest that we terminate unnamed unions with an "u".

We can make this a compile time option:

#ifdef NOT_GCC_4X
#define MY_UNION u
#else
#define MY_UNION
#endif

union {

} MY_UNION;

I see no problem about that. Else it will be a nightmare to port the code to other and especially older compilers.

Quoted 4 lines

It is not our choice. Linux v4l2 headers use these unions, software is written against these headers, we can't change the names unless we want to make extensive changes to the sources.

We can be compatible with both!

--HPS

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list