Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Basic question, but if there are no references and it’s all values all day long, then how do strings, arrays, and other types where the size unknown at compile time work?

I saw the example they gave, which is cool, but they were with string literals. So, per my question above, how would the same program work if the strings came from user input?



In my understanding, there are still pointers under the hood, they're just not exposed as such in the type system. If you can't copy a pointer you can't alias, so they're indistinguishable from the value itself in practice.




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

Search: