Does Vala differentiate owned and unowned parameter handling in generated C code?
0 reputation · 13 Mar 2025, 16:29 UTC
The goal is to verify whether the Vala compiler inserts different reference‑count operations in the generated C code for function parameters annotated as `owned` versus those annotated as `unowned`.
To do this, a minimal Vala project is built with Meson, the produced C file is examined for calls such as `g_steal_pointer` or `g_strdup` that indicate ownership transfer, and the same inspection is repeated for an `unowned` parameter. Because the handling of ownership annotations has changed between Vala releases before and after version 0.56, the outcome may depend on the toolchain version, and the current behavior is not documented as guaranteed.
Does the compiler currently emit distinct code for `owned` and `unowned` parameters? If not, what steps are needed to make ownership semantics enforceable?