On Wed, Mar 6, 2013 at 9:48 AM, Olivier Goffart <[email protected]> wrote:

>  This is not a warning, this is an error in C++
>
> enum Foo { A ,  B };
> Foo bar = 1; // error: invalid conversion from ‘int’ to ‘Foo’
> int blah = bar; // No warning. unless you use enum class then it is a
> error.
>

At least, I can second that even with msvc variants, but perhaps Alan meant
-fpermissive or so.

I think implicit casts is *not* a good idea.
>
> Allowing explicit casts should be good.
>

That would be a bit uglier in QML than a static or function type explicit
cast like in C++ unless there is a nice trick not to make map, object,
mapper function or so for enums with many values. Perhaps parseInt() or
something similar? I would not know.

If there is no nice trick, I would suggest allowing it (perhaps with a
warning on the console?) because I do not wish to maintain such code if I
know what I am doing. :)

Laszlo
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to