tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Bug in scanf?



On Wed, Dec 10, 2025 at 04:03:08PM +0100, Martin Husemann wrote:
> With two chars lookahead the parser can realize the e is not start of an
> exponent expression

Surely you need three chars lookahead for that, because the exponent can be
signed.

So given the string: 123e+foo if you are parsing the 3 and the intention is to
return 123 as the float and then parse e+foo as just text rather than
indicating an exponent part of the number 123, then you need to process both
e and +, (which at that point could still be a valid exponent), and return
failure only when you reach the f.


Home | Main Index | Thread Index | Old Index