Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Jul 1997 06:05:39 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        cvs-all@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, cvs-lib@FreeBSD.ORG, jkh@FreeBSD.ORG
Subject:   Re: cvs commit: src/lib/libc/stdio scanf.3 vfscanf.c
Message-ID:  <199707012005.GAA02012@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>jkh         1997/07/01 10:46:40 PDT
>
>  Modified files:
>    lib/libc/stdio       scanf.3 vfscanf.c 
>  Log:
>  Add 64 bit int support to scanf()
>  PR:		2080
>  Submitted by:	David Dawes <dawes@rf900.physics.usyd.edu.au>

I had this patch in my "needs more work" basket.  Its use of strtoq() and
strtouq() for ints and longs is inefficient in all cases and incompatible
in overflow cases.  The behaviour in overflow cases seems to be undefined,
so it isn't a bug that the submitted patch would change the result read
by sscanf("4294967296", "%ld", &foo) from INT_MAX to 0 (for 32-bit ints),
it is just incompatible.

The int vs long case was already poorly handled by using strtol() and
strtoul() for ints.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199707012005.GAA02012>