diff options
author | Jan Haller <bromeon@gmail.com> | 2024-07-13 13:10:57 +0200 |
---|---|---|
committer | Jan Haller <bromeon@gmail.com> | 2024-07-15 22:37:33 +0200 |
commit | b2a9ea6d22799c05a4c04d2b68cd85a678eb99d2 (patch) | |
tree | 7b6961586ca3d01d75341aa84cbe2d9d53b4c9df /core | |
parent | 97b8ad1af0f2b4a216f6f1263bef4fbc69e56c7b (diff) | |
download | redot-engine-b2a9ea6d22799c05a4c04d2b68cd85a678eb99d2.tar.gz |
GDExtension docs: advise bindings to use uint64_t for bitfields
Diffstat (limited to 'core')
-rw-r--r-- | core/extension/gdextension_interface.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/extension/gdextension_interface.h b/core/extension/gdextension_interface.h index d6c1df9c00..fce377f967 100644 --- a/core/extension/gdextension_interface.h +++ b/core/extension/gdextension_interface.h @@ -2800,12 +2800,16 @@ typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassVirtualMethod)(G * * Registers an integer constant on an extension class in the ClassDB. * + * Note about registering bitfield values (if p_is_bitfield is true): even though p_constant_value is signed, language bindings are + * advised to treat bitfields as uint64_t, since this is generally clearer and can prevent mistakes like using -1 for setting all bits. + * Language APIs should thus provide an abstraction that registers bitfields (uint64_t) separately from regular constants (int64_t). + * * @param p_library A pointer the library received by the GDExtension's entry point function. * @param p_class_name A pointer to a StringName with the class name. * @param p_enum_name A pointer to a StringName with the enum name. * @param p_constant_name A pointer to a StringName with the constant name. * @param p_constant_value The constant value. - * @param p_is_bitfield Whether or not this is a bit field. + * @param p_is_bitfield Whether or not this constant is part of a bitfield. */ typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassIntegerConstant)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_enum_name, GDExtensionConstStringNamePtr p_constant_name, GDExtensionInt p_constant_value, GDExtensionBool p_is_bitfield); |