Bug#171851: More missing math.h prototypes
On Mon, Dec 30, 2002 at 10:57:47AM -0500, Daniel Jacobowitz wrote:
> On Mon, Dec 30, 2002 at 10:23:16AM -0500, H. S. Teoh wrote:
> > Hi, I just confirmed that trunc() is missing from /usr/include/math.h.
> > Furthermore, the following are also missing (referenced from the manpage
> > of trunc()):
> > - lrint
> > - nearbyint
> > - round
> >
> > Oddly, these functions do *not* appear in the libc info pages.
> > Nevertheless, they are definitely in libm:
>
> How did you confirm that they were not in <math.h>? Judging from your
> previous messages, by using cpp or building a test program. I always
> recommend actually grepping around in /usr/include for them; it can be
> enlightening.
>
> Consider this case:
> #ifdef __USE_ISOC99
[snip]
Aha. That explains it. So these functions are only defined for ISO C99?
(And yes, I should've grepped the headers directly. I suppose I've become
a bit wary (perhaps too wary) of doing that because recently I saw a few
libc bugs where clearly the bug submitter was reading the .h file but not
actually trying to compile anything, and incorrectly thinking that e.g.
you need to define __USE_GNU where the documentation says defining
_GNU_SOURCE is sufficient. A simple compilation test quickly disproves
this. At any rate, apologies for jumping to conclusions too quickly.)
> They are only declared in C99 mode. I believe that is correct.
Is this indicated in the docs, though? As far as I can tell, the info
pages do not indicate that C99 mode is needed to use these functions.
> > This is on libc6 2.3.1-8. I'm not sure I understand why they are in the
> > .so but not in any header files nor in the info docs. Are there some
> > standard compliance issues here that I'm not aware of?
>
> They're in my copy of the info docs. Try:
> "info libc Arithmetic Arithmetic\ Functions Rounding\ Functions"
Yeah, I must've been doing something silly when I searched the info pages
(like using 'n' to find the next match, thinking it's vi. :-P)
Anyway, this bug now looks like a documentation bug/deficiency. The
manpages should add #define _ISO_SOURCE (or whatever the proper name was,
I forgot) for these functions, and the info pages should indicate the C99
prerequisite as well.
T
--
And life still goes on...
Reply to: