3 ms·
> The array iteration code is also solid. Shouldn't there be a NULL at the end of the array and do a null check in the iteration?
by kbumsik 7y ago
> The array iteration code is also solid.
Shouldn't there be a NULL at the end of the array and do a null check in the iteration?
- pm215 7y agoI think the last array entry {executeNoMatch , "A?"} will match on any string (and print the fallback "I don't know how to VERB" message), so it's impossible to fall off the end of the array. If you wanted to use a more defensive-programming style then you could add a sentinel of some kind and assert that you never hit it.