Hacker News new | ask | show | jobs
by jessermeyer 1459 days ago
But isn't `""` 0 terminated? So the first offset past the nil byte is 0, interpreted as an address.
1 comments

"" is empty, so ""[0] is the nil byte.

The code uses "" as an arbitrary address, and ""[1] as that address + 1.

This way this-"" gets you 1-based index into the array.

It assumes the compiler dedfuplicates strings, making the behavior of this program undefined.