This PR initialises the di_key struct member (in struct dictitem16_T which itself is inside struct vimvar) at compile time.
This means we can drop the length test and the string copy in evalvars_init(). The compiler will truncate the string if it is too long and will give a warning if -Wexcess-initializers is set like so (from clang 22.1.4):
evalvars.c:54:14: warning: initializer-string for char array is too long [-Wexcess-initializers] 54 | {VV_NAME("count0000000000000000", VAR_NUMBER), NULL, VV_COMPAT+VV_RO}, | ^~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated.
Cheers
John
https://github.com/vim/vim/pull/20185
(1 file)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
Thanks, is this warning a default? Okay, I just tested with gcc-15 and clang-21 and I can see a warning being emitted by either one without any specific arguments. Good, thanks
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()