Both builtins wrote only rettv->vval.v_number
and relied on call_func()
initialising rettv->v_type
to VAR_NUMBER
. Explicitly set
rettv->v_type = VAR_NUMBER;
rettv->vval.v_number = 0;
at function entry to avoid undefined behaviour and make the return type self-contained.
https://github.com/vim/vim/pull/18307
(1 file)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
thanks, makes sense
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
I don't think this is a good idea. call_func()
initializing rettv->v_type
to VAR_NUMBER
is a good thing to rely on.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Hm, I see. I just don't like the implicit dependency on call_func()
for setting the type. If you think it doesn't make sense, I can revert it again.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.