This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Puzzled!
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Roland McGrath <roland at redhat dot com>
- Cc: Paolo Carlini <pcarlini at unitus dot it>, libc-alpha at sources dot redhat dot com, Ulrich Drepper <drepper at redhat dot com>
- Date: Fri, 6 Dec 2002 12:17:17 +0100
- Subject: Re: Puzzled!
- References: <3DEFA568.8040700@unitus.it> <200212052126.gB5LQte20876@magilla.sf.frob.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Dec 05, 2002 at 01:26:55PM -0800, Roland McGrath wrote:
> > * The macro |math_errhandling| is not defined in |math.h|
>
> >From glibc/CONFORMANCE:
>
> Implementing MATH_ERRNO, MATH_ERREXCEPT and math_errhandling in
> <math.h> needs compiler support: see
>
> http://sources.redhat.com/ml/libc-hacker/2000-06/msg00008.html
> http://sources.redhat.com/ml/libc-hacker/2000-06/msg00014.html
> http://sources.redhat.com/ml/libc-hacker/2000-06/msg00015.html
What exactly is required on gcc side? Verifying that without -ffast-math
all float builtins on EDOM/ERANGE arguments either set errno, or bail to
library functions?
> > * The |hh| specifier for |d|, |i|,|o|,|u|,|x|, or |X| conversion
> > specifier does not convert the value to a |signed| or |unsigned|
> > char before printing. This applies to both the wide and narrow
> > versions of the input/output functions.
>
> Yes it does.
Not for d or i.
#include <stdio.h>
int main (void)
{
printf ("%hhd\n", -321);
printf ("%hhu\n", 321);
printf ("%hhd\n", -126);
printf ("%hhu\n", -126);
printf ("%hhd\n", 231);
printf ("%hhu\n", 231);
printf ("%hhd\n", 312);
printf ("%hhu\n", 312);
}
gives:
-321
65
-126
130
231
231
312
56
But see Joseph's mail; for signed conversions I think there is no arguing
that it falls into implementation-defined area.
> > * The |SCN| macros for unsigned integers that correspond to the |X|
> > specifier for |fscanf| in |inttypes.h| are not implemented.
>
> Are there supposed to be SCNX* in addition to SCNx*?
They are allowed, not required, but I don't see much value in defining SCNX*,
as it has the same behaviour as SCNx*.
ISO C99 7.8.1:
...
4 The fscanf macros for signed integers are:
SCNdN SCNdLEASTN SCNdFASTN SCNdMAX SCNdPTR
SCNiN SCNiLEASTN SCNiFASTN SCNiMAX SCNiPTR
5 The fscanf macros for unsigned integers are:
SCNoN SCNoLEASTN SCNoFASTN SCNoMAX SCNoPTR
SCNuN SCNuLEASTN SCNuFASTN SCNuMAX SCNuPTR
SCNxN SCNxLEASTN SCNxFASTN SCNxMAX SCNxPTR
...
7.26.4 Format conversion of integer types <inttypes.h>
1 Macro names beginning with PRI or SCN followed by any lowercase letter or X may be
added to the macros defined in the <inttypes.h> header.
Jakub