#638·clay

[Question] WarningArray allocation uses sizeof(Clay_String) instead of sizeof(Clay_Warning)

Author: KermalisCreated Jun 30, 2026Updated Jun 30, 2026

In Clay__WarningArray_Allocate_Arena(), sizeof(Clay_String) is used instead of sizeof(Clay_Warning). https://github.com/nicbarker/clay/blob/main/clay.h#L3956

This function is called with a capacity of 100. Because a Clay_Warning is just two Clay_Strings, this means the capacity is effectively 50 for the warning array, which could lead to out of bounds accesses because the capacity of 100 is still used in range checks.

However, none of this seems to matter because Clay__WarningArray_Add() is unused, effectively making the whole array a waste of the arena's memory. So my question is, is all of this just legacy code that's leftover? Warnings are only shown to the user with the debug view, but there are never any warnings anyway.