Use default initialization

{ 0 } initializes only first element with zero explicitly and other
elements with their default value (zeros too). Technically it will work
the same, but will be more correct.
This commit is contained in:
Hennadii Chernyshchyk 2021-09-19 20:54:34 +03:00 committed by Bastiaan Olij
parent 7a2a7ea9e4
commit 2b1100c878

View File

@ -238,7 +238,7 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
result.append(f"class {class_name} {{") result.append(f"class {class_name} {{")
result.append(f"\tstatic constexpr size_t {snake_class_name}_SIZE = {size};") result.append(f"\tstatic constexpr size_t {snake_class_name}_SIZE = {size};")
result.append(f"\tuint8_t opaque[{snake_class_name}_SIZE] {{ 0 }};") result.append(f"\tuint8_t opaque[{snake_class_name}_SIZE] = {{}};")
result.append( result.append(
f"\t_FORCE_INLINE_ GDNativeTypePtr ptr() const {{ return const_cast<uint8_t (*)[{snake_class_name}_SIZE]>(&opaque); }}" f"\t_FORCE_INLINE_ GDNativeTypePtr ptr() const {{ return const_cast<uint8_t (*)[{snake_class_name}_SIZE]>(&opaque); }}"
) )