This issue was identified during a Codex code review.
Empty buffers currently have inconsistent observable states:
buffer{} has size zero, a null data pointer, and converts to false;
buffer{0} has size zero but normally receives a non-null allocation and converts to true;
- copying a default empty buffer can change its boolean state from
false to true.
Define whether operator bool() means “contains data” or “owns an allocation”, and make construction and copying preserve that meaning. Add tests for every empty-buffer construction path.
This issue was identified during a Codex code review.
Empty buffers currently have inconsistent observable states:
buffer{}has size zero, a null data pointer, and converts tofalse;buffer{0}has size zero but normally receives a non-null allocation and converts totrue;falsetotrue.Define whether
operator bool()means “contains data” or “owns an allocation”, and make construction and copying preserve that meaning. Add tests for every empty-buffer construction path.