Hacker News new | past | comments | ask | show | jobs | submit login

A waste of 8 bytes?



If we define `String` type as `{size_t len, size_t offset, char *data}`, then we can store up to 23 bytes directly in the struct, if we will sacrifice 1 bit of `len` field to indicate that.


7, since keeping track of the length allows you to skip storing the trailing 0.


Well technically that's implementation-defined, but yes.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: