This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: ["Vadim Zhukovsky" <zva@ukrpost.net>] scanf bug
- To: Andreas Jaeger <aj at suse dot de>
- Subject: Re: ["Vadim Zhukovsky" <zva@ukrpost.net>] scanf bug
- From: Jakub Jelinek <jakub at redhat dot com>
- Date: Tue, 17 Jul 2001 17:34:02 +0200
- Cc: libc-alpha at sources dot redhat dot com, Vadim Zhukovsky <zva at ukrpost dot net>
- References: <hog0bvsk8t.fsf@gee.suse.de>
- Reply-To: Jakub Jelinek <jakub at redhat dot com>
On Tue, Jul 17, 2001 at 04:28:18PM +0200, Andreas Jaeger wrote:
>
> The appended bug report is not resolved yet. Could somebody look into
> it, please?
Are you sure it is a bug?
I think ISO C99 sais about this in 7.19.6.2.10:
... if the result of the conversion cannot be represented in the object, the
behaviour is undefined.
7.19.6.2.12 sais 'i' conversion's argument is signed integer, and
01000000000000000000000 does not fit into signed long long.
> #include <stdio.h>
> #include <stdlib.h>
>
> const char *oct_long_long = "01000000000000000000000";
>
> void main()
> {
> long long ll1, ll2;
> sscanf(oct_long_long, "%Lo", &ll1);
> sscanf(oct_long_long, "%Li", &ll2);
> printf("%%Lo: %Ld, %%Li: %Ld\n", ll1, ll2);
> }
> ----------------------------------------------------------------
> %Lo: -9223372036854775808, %Li: 9223372036854775807
Jakub