plugins: add type strictness to plugin descriptor macros
- Feb 03, 2022
-
-
The previous commit made use of compound literals. MSVC was identified as not yet having support for compound literals in C++ though, which is considered a blocking problem to their use. This work around was suggested by Alexandre Janniaux.
17604330 -
I.e. check the type of the values provided, rather than just blindly casting, and thus allow mistakes to get caught with compilation errors. I once lost some hours tracking down the cause of a crash that this type strictness would have prevented. Note, now that `change_string_list()` and `change_integer_list()` use type strictness for the value and label arrays to help make sure they're the right types, we can more safely make use of `ARRAY_SIZE()` to more cleanly get the length. `set_callback[s]()` is excluded from this for obvious reasons. I've taken the opportunity to ditch remaining use of Hungarian notation and to fix a param name that should be singular rather than plural (psz_caps on `add_module[_list]()`. Re-implemented using compound literals upon excellent suggestion by Alexandre Janniaux.
e8f6a595
-