understanding vala compilation warnings

后端 未结 1 973
无人及你
无人及你 2020-12-11 18:11

The compilation warnings below are not so clear to me, appart from the deprecation warhing, but the signature of the method in the valadoc :

http://valadoc.org/#!a

相关标签:
1条回答
  • 2020-12-11 18:21

    You can generally ignore warnings from the C compiler when using Vala. Vala has better information than the C compiler, so it knows certain things are valid when the C compiler has no way of knowing that. Unfortunately we can't just add casts everywhere since there are situations where we can't generate a valid cast (and, what's more, no way to know what those situations are).

    The final warning, about g_type_init being deprecated, is because g_type_init is no longer necessary as of glib 2.36. You can get rid of that warning by passing --target-glib=2.36 (or any later version of glib) to valac, but be warned that the generated code may no longer work with older versions of glib.

    TBH, I often just pass -X -w to valac to get the C compiler to be quiet. Occasionally I miss a useful warning, but it gets rid of a lot of useless warnings.

    0 讨论(0)
提交回复
热议问题