4 ms·
One great way of dealing with this at a software engineering level is to stop operating on arrays of characters, and instead add functionality on a case-by-case
by rtpg 9y ago
One great way of dealing with this at a software engineering level is to stop operating on arrays of characters, and instead add functionality on a case-by-case basis.
For example, you have a wrapper that only lets you iterate forwards. Once you hit languages where you need to "move back", you have to explicitly code in the functioanality. And in theory you can do it in a safe way.
Sure, some might argue you'll end back at arrays. But I believe that if you encode the traversals in a specific way, you'll at least end up at bounds-safe arrays.
For example, if you use an array as a queue, but some other part of the code doesn't, you're gonna have problems. But if you wrap your thing as a queue, no other part of the code will be able to pierce the veil.
Though I don't know how how well C abstractions let you do this.
- Manishearth 9y agoI think this oversimplifies the problem. OpenType basically requires you to operate on a glyph buffer. What you can do, is try and make all glyph buffer operations throw an error that makes you hit a fallback case.