From 2ff3e7fb2bd017dddd187065078c21126f959cbe Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 11 Oct 2025 17:34:51 -1000 Subject: [PATCH 1/2] add comments for bot --- esphome/core/helpers.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index 864fd92ffc..3782875dcf 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -190,7 +190,9 @@ template class FixedVector { } } - // Add element (no reallocation - must have initialized capacity) + /// Add element without bounds checking + /// Caller must ensure sufficient capacity was allocated via init() + /// Silently ignores pushes beyond capacity to avoid runtime overhead void push_back(const T &value) { if (size_ < capacity_) { data_[size_++] = value; @@ -199,6 +201,8 @@ template class FixedVector { size_t size() const { return size_; } + /// Access element without bounds checking (matches std::vector behavior) + /// Caller must ensure index is valid (i < size()) T &operator[](size_t i) { return data_[i]; } const T &operator[](size_t i) const { return data_[i]; } }; From 4c00861760ce5fd22b7ac82584ba9dd20f1e23ee Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 11 Oct 2025 17:35:31 -1000 Subject: [PATCH 2/2] add comments for bot --- esphome/core/helpers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index 3782875dcf..b5a0a1c8ac 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -192,7 +192,7 @@ template class FixedVector { /// Add element without bounds checking /// Caller must ensure sufficient capacity was allocated via init() - /// Silently ignores pushes beyond capacity to avoid runtime overhead + /// Silently ignores pushes beyond capacity (no exception or assertion) void push_back(const T &value) { if (size_ < capacity_) { data_[size_++] = value;