godot icon indicating copy to clipboard operation
godot copied to clipboard

Core: Readd Variant class initializer, fix comment

Open Repiteo opened this issue 1 year ago • 4 comments

Fixes two minor issues in variant.h:

  • Readded the class initalizer for type (#90866 regression).
  • Updated the comment that specifies Variant's byte allocation & when it allocates extra memory.

Repiteo avatar May 14 '24 16:05 Repiteo

It also technically allocates data for the (packed) arrays and dicts, but for static sized data this is correct

AThousandShips avatar May 14 '24 16:05 AThousandShips

That should still be fine in this context; allocates extra memory only comments on the times when it will exceed 24/40 bytes in size, not when allocation occurs period.

Repiteo avatar May 14 '24 16:05 Repiteo

It does exceed that as it allocates a reference to those types, but the size of those depends on pointer sizes and alignment so might be platform dependent, but it does allocate extra data, just not of fixed size, as those data types (including PackedArrayRef<T>, which holds one SafeRefCount and one Vector<T>) do their own allocations

AThousandShips avatar May 14 '24 16:05 AThousandShips

Ahhh, now I see what you mean. No harm in making that a footnote as well.

Repiteo avatar May 14 '24 17:05 Repiteo

Thanks!

akien-mga avatar May 15 '24 10:05 akien-mga