Show HN: SSO – Small String Optimization https://ift.tt/3Pwh7Br

Show HN: SSO – Small String Optimization I wrote this just for fun when saw article about sso in Rust[1]. My string can store up to 23 (excluding null-terminator) 8-bit chars without calling allocator. Here I can mistake, but.. Curious fact: both - libstdc++[2] and libc++[3] - do access to union member without any check that it is active now. AFAIK, this is UB in C++. But I assume that they just rely on theirs compiler features. I tried to avoid this using `std::byte[]`. But I'm still sure that there are several UB's in my code :) [1] https://ift.tt/gZqIjAc... [2] https://ift.tt/jhbtPU5... [3] https://ift.tt/2Qb73dJ... https://ift.tt/KdGpYfQ October 12, 2024 at 11:56PM

Comments

Popular posts from this blog

Show HN: Samsar One Version One is now live https://ift.tt/THDkKSc

"Love Story Is Written In..." Ex-India Opener On MS Dhoni's Knock vs LSG

Show HN: Krixik – Easily sequence small/specialized AI models (pip-installable) https://ift.tt/9nDHzUF