Hi On Fri, Oct 4, 2013 at 2:34 PM, Daniel Stone <dan...@fooishbar.org> wrote: > On 4 October 2013 13:09, Wander Lairson Costa <wander.lair...@gmail.com> > wrote: >> That's what the patch is about: avoid casts. Whenever you use a cast, >> you are giving up the help the compiler may give to you regarding >> invalid type conversions. So, I always use the rule of thumb of >> avoiding casts whenever I can. IMO, this is not a harmful patch and >> will make the C++ programmers a little bit easier. > > I can see where it's going, but on the other hand xkb_mod_mask_t is > _so_ not the right type. That's a bitmask of actual modifiers (i.e. > the return value), not a bitmask of components. So it avoids the > cast, but also makes the API look extremely misleading, as we've > documented exactly what xkb_mod_mask_t is. > > I really like the type safety aspect, so to be honest I'm just > inclined to make C++ wear the cast for now.
We had a similar discussion when I pointed out that "enum" may change the underlying type without notice when adding new enum-values. But I agree with Daniel, the GCC type-safety for enums in C is a very handy feature. So I'm also no big fan of the patch, sorry. Thanks David _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel