[openbeos] Re: broken struct mouse_map in InterfaceDefs.h
- From: Jérôme Duval <korli@xxxxxxxx>
- To: openbeos@xxxxxxxxxxxxx
- Date: Mon, 12 Jan 2004 10:25:26 +0100
Could binary compatibility happen ?
For example, sizeof(struct mouse_map) won't be equal in R5 and OBOS R1 with
this.
I think the best you can get is source compat.
Cheers,
Jerome
Selon Andrew Bachmann <shatty@xxxxxxxxxxxxx>:
> Oops,
>
> Looks like I lose in at least 2 ways:
>
> Way #1: no R5 compiler supports anonymous structs as union members.
> Way #2: anonymous unions in structs are C++ feature and will not
> compile in C
>
> So, for future reference all: no anonymous unions in structs in any
> headers that are supposed to be C friendly.
>
> In my searchings on this issue I also found a warning about interchanging
> access to union members. (that is to say, using a union as a
> reinterpretation
> of the members.) Apparently the spec doesn't require such things to work
> in the way you expect. Even on a C++ compiler that supported what I
> wrote earlier, for example, middle could be mapped to button[0] instead
> of button[2] as one might expect.
>
> I think we have to use separate structs. Any other suggestions?
>
> Andrew
>
> "Andrew Bachmann" <shatty@xxxxxxxxxxxxx> wrote:
> [snip]
> > I think this is at least a source compatible version:
> >
> > struct mouse_map {
> > union {
> > struct {
> > uint32 left;
> > uint32 right;
> > uint32 middle;
> > };
> > uint32 button[B_MAX_MOUSE_BUTTONS];
> > };
> > };
> >
> > This still has a binary compat problem. A better alternative
> > would seem to be to use a new struct.
> >
- Follow-Ups:
- [openbeos] Re: broken struct mouse_map in InterfaceDefs.h
- From: Andrew Bachmann
- References:
- [openbeos] Re: broken struct mouse_map in InterfaceDefs.h
- From: Andrew Bachmann
Other related posts:
- » [openbeos] broken struct mouse_map in InterfaceDefs.h
- » [openbeos] Re: broken struct mouse_map in InterfaceDefs.h
- » [openbeos] Re: broken struct mouse_map in InterfaceDefs.h
- » [openbeos] Re: broken struct mouse_map in InterfaceDefs.h
- » [openbeos] Re: broken struct mouse_map in InterfaceDefs.h
- » [openbeos] Re: broken struct mouse_map in InterfaceDefs.h
- [openbeos] Re: broken struct mouse_map in InterfaceDefs.h
- From: Andrew Bachmann
- [openbeos] Re: broken struct mouse_map in InterfaceDefs.h
- From: Andrew Bachmann