4 ms·
> For this use case, would it be required to have a hard-coded upper bound additionally? Yes. It can be a few orders of magnitude higher than your expected arr
by falcolas 11y ago
> For this use case, would it be required to have a hard-coded upper bound additionally?
Yes. It can be a few orders of magnitude higher than your expected array size: the goal is to prevent infinite loops. If you're looping over short user provided strings, if you hit an arbitrary counter of 1M, something probably went wrong, and the code should error out appropriately.
- MichaelGG 11y agoIt's interesting to note that Intrado's recent 9-1-1 service outage was due to a hard-coded limit on the total number of calls that could pass through their system. Took them many hours to get the system back online after the limit was hit and further calls rejected. Though I suppose in real safety critical systems, you often review these limits and make sure they still apply.
- humanrebar 11y agoRight. You'd also want a soft limit. Your regular diagnostics would notice the counter was over the soft limit and turn on the equivalent of a 'check engine' light.