Puzzled!
Jakub Jelinek
jakub@redhat.com
Fri Dec 6 03:17:00 GMT 2002
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
More information about the Libc-alpha
mailing list