C99 std documentation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lars Tackmann

    C99 std documentation

    Is there a good online description of the ansi c99 std lib - sinse many of
    the functions describet in k&r (eg. ceil is missing) does not seam to be
    in c99.

    Thanks.
  • Simon Biber

    #2
    Re: C99 std documentation

    "Lars Tackmann" <roland@diku.dk > wrote:[color=blue]
    > Is there a good online description of the ansi c99 std lib - sinse
    > many of the functions describet in k&r (eg. ceil is missing) does
    > not seam to be in c99.[/color]

    The Dinkum C99 Library reference is probably the best I've found,
    short of paying your US$18 to ANSI to download the PDF of the
    actual C99 standard.



    --
    Simon.


    Comment

    • pete

      #3
      Re: C99 std documentation

      Lars Tackmann wrote:[color=blue]
      >
      > Is there a good online description of the ansi c99 std lib
      > - sinse many of the functions describet in k&r
      > (eg. ceil is missing) does not seam to be in c99.[/color]

      It seems to be in N869.



      Committee Draft -- January 18, 1999 WG14/N869

      7.12.9.1 The ceil functions
      Synopsis
      [#1]
      #include <math.h>
      double ceil(double x);
      float ceilf(float x);
      long double ceill(long double x);
      Description
      [#2] The ceil functions compute the smallest integer value
      not less than x: |x|.
      Returns
      [#3] The ceil functions return the smallest integer value
      not less than x, expressed as a floating-point number.


      --
      pete

      Comment

      • Jack Klein

        #4
        Re: C99 std documentation

        On Fri, 26 Dec 2003 13:16:26 +0100, Lars Tackmann <roland@diku.dk >
        wrote in comp.lang.c:
        [color=blue]
        > Is there a good online description of the ansi c99 std lib - sinse many of
        > the functions describet in k&r (eg. ceil is missing) does not seam to be
        > in c99.
        >
        > Thanks.[/color]

        What makes you think that they are not in C99? What are you using to
        determine that, if you don't have a reference? There were no
        functions at all removed from the standard library by C99. ceil() is
        still there, along with specialized float and long double versions
        added.

        --
        Jack Klein
        Home: http://JK-Technology.Com
        FAQs for
        comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
        comp.lang.c++ http://www.parashift.com/c++-faq-lite/
        alt.comp.lang.l earn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq

        Comment

        • Lars Tackmann

          #5
          Re: C99 std documentation

          On Fri, 26 Dec 2003, Jack Klein wrote:
          [color=blue]
          > What makes you think that they are not in C99? What are you using to
          > determine that, if you don't have a reference? There were no
          > functions at all removed from the standard library by C99. ceil() is
          > still there, along with specialized float and long double versions
          > added.
          >
          > --
          > Jack Klein
          > Home: http://JK-Technology.Com
          > FAQs for
          > comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
          > comp.lang.c++ http://www.parashift.com/c++-faq-lite/
          > alt.comp.lang.l earn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
          >[/color]

          Well when I looked in the math.h header - there is no ceil
          function/prototype and my linker (included with gcc 3.2.2) says

          gcc -std=c99 test.c

          /tmp/ccofZXVf.o(.tex t+0x19): In function `insert':
          : undefined reference to `ceil'
          /tmp/ccofZXVf.o(.tex t+0x6c): In function `insert':
          : undefined reference to `ceil'
          collect2: ld returned 1 exit status

          and yes i have included math.h, the code compiles fine with gcc 2.96. So
          is it just the gnu implementation there is buggy or am i suposed to include
          som other file in order to get that functionX.


          thanks

          Comment

          • Alan Balmer

            #6
            Re: C99 std documentation

            On Sat, 27 Dec 2003 00:00:44 +0100, Lars Tackmann <roland@diku.dk >
            wrote:
            [color=blue]
            >
            >Well when I looked in the math.h header - there is no ceil
            >function/prototype and my linker (included with gcc 3.2.2) says[/color]

            Your initial question (Is ceil included in C99?) is answered. The
            question of how to persuade gcc to let you use it should be asked in
            another newsgroup.

            --
            Al Balmer
            Balmer Consulting
            removebalmercon sultingthis@att .net

            Comment

            • Alexander Bartolich

              #7
              Re: C99 std documentation

              begin followup to Lars Tackmann:[color=blue]
              > gcc -std=c99 test.c
              >
              > /tmp/ccofZXVf.o(.tex t+0x19): In function `insert':
              >: undefined reference to `ceil'[/color]

              Add -lm to your compiler flags.

              --
              Für Google, Tux und GPL!

              Comment

              • August Derleth

                #8
                Re: C99 std documentation

                Lars Tackmann <roland@diku.dk > wrote in
                news:Pine.LNX.4 .58.03122623471 50.2155@brok.di ku.dk on Fri 26 Dec 2003
                04:00:44p:
                [color=blue]
                > Well when I looked in the math.h header - there is no ceil
                > function/prototype and my linker (included with gcc 3.2.2) says
                >
                > gcc -std=c99 test.c
                >
                > /tmp/ccofZXVf.o(.tex t+0x19): In function `insert':
                >: undefined reference to `ceil' /tmp/ccofZXVf.o(.tex t+0x6c): In function
                >: `insert': undefined reference to `ceil' collect2: ld returned 1 exit
                >: status[/color]

                [OT]
                That's the linker talking to you, not the compiler. (See that the file is
                now in /tmp and has a name no rational human would give it? That's where
                the assembler shoved the object code once it had generated it.) The linker
                doesn't like that you didn't tell it to link against libm.a, the GNU
                Project's math library, and now it can't find ceil. The best way to link
                against libm.a is to add the flag -lm to your gcc command line. The
                compiler will pass it along to the linker, and the linker will be happy.

                Some people consider this to be a mistake in how the GNU Compiler
                Collection was designed. I say, it's the price of using a great build
                environment.
                [/OT]

                In any case, this is all massively off-topic here. Try
                comp.linux.prog rammers or some such.

                Comment

                • Simon Biber

                  #9
                  Re: [OT] C99 std documentation

                  While we're off-topic,

                  "August Derleth" <libertarian232 003**@onewest.n et> wrote:[color=blue]
                  > [OT][/color]
                  ....[color=blue]
                  > Some people consider this to be a mistake in how the GNU Compiler
                  > Collection was designed. I say, it's the price of using a great
                  > build environment.[/color]

                  The split of the C library into libc and libm is a historical UNIX
                  thing. The problem has nothing to do with the design of the GNU
                  Compiler Collection, and existed long before GCC did.

                  Other compilers on Unix also require separate linking of the math
                  section of the C library. GCC on other platforms does not require
                  separate linking of the math section. Therefore, libm is orthogonal
                  to GCC.
                  [color=blue]
                  > [/OT][/color]

                  --
                  Simon.


                  Comment

                  • Dan Pop

                    #10
                    Re: [OT] C99 std documentation

                    In <401077f6$0$261 18$afc38c87@new s.optusnet.com. au> "Simon Biber" <news@ralminNOS PAM.cc> writes:
                    [color=blue]
                    >While we're off-topic,
                    >
                    >"August Derleth" <libertarian232 003**@onewest.n et> wrote:[color=green]
                    >> [OT][/color]
                    >...[color=green]
                    >> Some people consider this to be a mistake in how the GNU Compiler
                    >> Collection was designed. I say, it's the price of using a great
                    >> build environment.[/color]
                    >
                    >The split of the C library into libc and libm is a historical UNIX
                    >thing. The problem has nothing to do with the design of the GNU
                    >Compiler Collection, and existed long before GCC did.
                    >
                    >Other compilers on Unix also require separate linking of the math
                    >section of the C library. GCC on other platforms does not require
                    >separate linking of the math section. Therefore, libm is orthogonal
                    >to GCC.[/color]

                    Especially considering that gcc is a compiler only, while the math
                    library functions are, obviously, a library issue.

                    Merge libc and libm together on a Unix system and gcc won't need any -lm
                    option to properly link programs using the <math.h> stuff.

                    Dan
                    --
                    Dan Pop
                    DESY Zeuthen, RZ group
                    Email: Dan.Pop@ifh.de

                    Comment

                    • Alan Balmer

                      #11
                      Re: [OT] C99 std documentation

                      On Fri, 23 Jan 2004 12:25:59 +1100, "Simon Biber"
                      <news@ralminNOS PAM.cc> wrote:
                      [color=blue]
                      >While we're off-topic,
                      >
                      >"August Derleth" <libertarian232 003**@onewest.n et> wrote:[color=green]
                      >> [OT][/color]
                      >...[color=green]
                      >> Some people consider this to be a mistake in how the GNU Compiler
                      >> Collection was designed. I say, it's the price of using a great
                      >> build environment.[/color]
                      >
                      >The split of the C library into libc and libm is a historical UNIX
                      >thing. The problem has nothing to do with the design of the GNU
                      >Compiler Collection, and existed long before GCC did.
                      >
                      >Other compilers on Unix also require separate linking of the math
                      >section of the C library. GCC on other platforms does not require
                      >separate linking of the math section. Therefore, libm is orthogonal
                      >to GCC.[/color]

                      Some implementations had several math libraries, and allowed the
                      programmer to use linker directives to choose the one he wanted to
                      use. One for hardware FPP, one for another variety of FPP, one for
                      proprietary software floating point, one for software emulation of a
                      hardware FPP, one which would test for the presence of an FPP and use
                      software emulation if it wasn't present, etc.
                      [color=blue]
                      >[color=green]
                      >> [/OT][/color][/color]

                      --
                      Al Balmer
                      Balmer Consulting
                      removebalmercon sultingthis@att .net

                      Comment

                      Working...