Skip to content

Comment on Ask HN: Favorite Debugging Story?

Comments

On my first programming lesson I could not figure up how to store some content with NULL bytes (such as a webpage) in C++ string and the teacher did not know it either.

Did you ever figure it out?

This is the exact situation that I always liked to show my students, because it shows the power of abstractions, in this case the c++ string object, and the danger of making assumptions about data. And then, finally, showing them how it is very much possible, and it was designed into the library in order to accommodate such use cases. Basically, I used it as a tool to help them better understand the data representation of strings, as well as for them to learn something deeper about the c++ standard library.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.