5 ms·
Whenever you do lexical analysis on syntax containing numbers. On today's hand-held supercomputers avoiding allocations and, generally, exercising memory-effic
by tempodox 5y ago
Whenever you do lexical analysis on syntax containing numbers.
On today's hand-held supercomputers avoiding allocations and, generally, exercising memory-efficiency may not be a primary concern, but it very much was at the time when this stuff was built. And it's still relevant today on restricted systems, like microcontrollers, where C is still the primary language.
- lifthrasiir 5y ago> Whenever you do lexical analysis on syntax containing numbers. If that was an intention C should have a full set of lexical analysis functions, but it doesn't (scanf doesn't count). strtol being able to distinguish two error cases and thus being marginally useful for lexical analysis is most likely accidental.
- xigoi 5y agoIn my experience, reading a single number is a much much much more common operation than doing lexical analysis.