Enums, bitfields and wl_arrays
Nils Chr. Brause
nilschrbrause at gmail.com
Tue Oct 13 08:54:01 PDT 2015
On Tue, Oct 13, 2015 at 5:18 PM, Erik De Rijcke <derijcke.erik at gmail.com> wrote:
>
>
> On Tue, Oct 13, 2015 at 4:35 PM, Nils Chr. Brause <nilschrbrause at gmail.com>
> wrote:
>>
>> Hi,
>>
>> On Mon, Oct 12, 2015 at 11:08 AM, Pekka Paalanen <ppaalanen at gmail.com>
>> wrote:
>> > On Mon, 12 Oct 2015 10:41:22 +0200
>> > Erik De Rijcke <derijcke.erik at gmail.com> wrote:
>> >
>> >> Adding enum members is backward compatible for Java. If you compile
>> >> against
>> >> an enum with 2 members, and later on a new member is added, you can
>> >> simply
>> >> use the new version of the enum.
>> >>
>> >> Important however is that the order of old members do not change when
>> >> new
>> >> members are added.
>> >
>> > This is important. I don't think anyone has ever mentioned anything
>> > like this before.
>> >
>> > We certainly have not expected the order to matter inside an <enum>
>> > tag, since we require the value to be explicitly given. Not when you
>> > are coming from C, anyway.
>>
>> In C++ the order doesn't matter either, since each entry has a defined
>> value.
>> I wonder why this is different in Java?
>
> Because Java is not C/C++. In Java, enum values are unique by instance
> alone. It does not have user 'defined' value(s) that make it unique. It
> *can* have user defined properties (like any object) in addition to
> implicit compiler generated enum type specific properties. One of those
> properties is it's "ordinal". Change the order of the enums and the ordinal
> property will change, which can cause undefined behavior. Now you need to
> wonder no more. :)
I'm not a Java developer, I just want to understand and help :)
I suppose you couldn't just ignore the ordinal property and solely rely on some
user defined propery, which holds the value defined in the XML file?
>
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
More information about the wayland-devel
mailing list