4 ms·
It seems really fragile that tame takes a string as argument that is tokenized and parsed? Why not just pass an array of pre-defined constants.
by arianvanp 11y ago
It seems really fragile that tame takes a string as argument that is tokenized and parsed? Why not just pass an array of pre-defined constants.
- gecko 11y agoBecause an array wouldn't be any safer than the string (still would be null-terminated or risk buffer overruns if you passed the length incorrectly), and using a string means you don't have to import a pile of constants if you want to use tame from languages other than C.
- michaelmior 11y agoYou could use bit flags to avoid the array issue. Your point about constants is reasonable although given that it's a one-time cost and there are already automated tools to do this for many popular languages, I don't think it presents a real barrier. Edit: I see they originally use a bit mask and then changed to the space-separated string. http://www.tedunangst.com/flak/post/string-interfaces http://www.tedunangst.com/flak/post/string-interfaces
- cremno 11y agohttp://www.tedunangst.com/flak/post/string-interfaces http://www.tedunangst.com/flak/post/string-interfaces