standard libraries

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jim Showalter

    #1

    standard libraries

    Does a hosted implementation require any particular libraries in order to be
    considered a standard C compiler?
    --
    _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
    _/ Everything should be made as simple as possible, but not simpler.
    _/ -- Albert Einstein
    _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  • jacob navia

    #2
    Re: standard libraries

    Jim Showalter wrote:
    Does a hosted implementation require any particular libraries in order to be
    considered a standard C compiler?
    I suppose that the standard C library (at least) should be present.
    In any case a compiler without any library is not very useful...

    jacob

    Comment

    • Richard Heathfield

      #3
      Re: standard libraries

      Jim Showalter said:
      Does a hosted implementation require any particular libraries in order to
      be considered a standard C compiler?
      A hosted implementation must provide all the standard library functions, but
      the Standard does not say in what form they must be provided.

      --
      Richard Heathfield
      "Usenet is a strange place" - dmr 29/7/1999

      email: rjh at above domain (but drop the www, obviously)

      Comment

      • pete

        #4
        Re: standard libraries

        Jim Showalter wrote:
        >
        Does a hosted implementation require
        any particular libraries in order to be
        considered a standard C compiler?
        Yes.

        C89, hosted:
        <assert.h<local e.h<stddef.h>
        <ctype.h<math.h <stdio.h>
        <errno.h<setjmp .h<stdlib.h>
        <float.h<signal .h<string.h>
        <limits.h<stdar g.h<time.h>

        C89, freestanding:
        <float.h<limits .h<stdarg.h>
        <stddef.h>

        C99, hosted:
        <assert.h<compl ex.h<ctype.h>
        <errno.h<fenv.h <float.h>
        <inttypes.h<iso 646.h<limits.h>
        <locale.h<math. h<setjmp.h>
        <signal.h<stdar g.h<stdbool.h>
        <stddef.h<stdin t.h<stdio.h>
        <stdlib.h<strin g.h<tgmath.h>
        <time.h<wchar.h <wctype.h>

        C99, freestanding
        <float.h<iso646 .h<limits.h>
        <stdarg.h<stdbo ol.h<stddef.h>
        <stdint.h>

        --
        pete

        Comment

        • pete

          #5
          Re: standard libraries

          Richard Heathfield wrote:
          >
          Jim Showalter said:
          >
          Does a hosted implementation require
          any particular libraries in order to
          be considered a standard C compiler?
          >
          A hosted implementation must provide
          all the standard library functions, but
          the Standard does not say in what form they must be provided.
          Yes.

          This directive in a C file: #include <float.h>
          only means that the compiler has to compile the C file
          as though float.h was pasted in there.
          If that can be done without a float.h file being present,
          then there doesn't need to be a float.h file
          in the hosted implementation.

          --
          pete

          Comment

          • Jim Showalter

            #6
            Re: standard libraries

            jacob navia wrote:
            >
            I suppose that the standard C library (at least) should be present.
            In any case a compiler without any library is not very useful...
            >
            jacob
            That's what I thought, too. But I've installed the latest versions of MinGW
            along with gcc-core, and cannot find even a mention of libc or glibc.

            --
            _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
            _/ Everything should be made as simple as possible, but not simpler.
            _/ -- Albert Einstein
            _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

            Comment

            • Keith Thompson

              #7
              Re: standard libraries

              Jim Showalter <jim_showalter@ hotmail.comwrit es:
              jacob navia wrote:
              >I suppose that the standard C library (at least) should be present.
              >In any case a compiler without any library is not very useful...
              >
              That's what I thought, too. But I've installed the latest versions
              of MinGW along with gcc-core, and cannot find even a mention of libc
              or glibc.
              The standard says nothing about "libc" or "glibc". As long as a
              program that includes standard headers and calls standard library
              functions works as specified in the standard, it doesn't matter how
              the implementation does it.

              <OT>gcc typically uses whatever runtime library is provided by the
              underlying operating system. I don't know what MinGW does.</OT>

              If you're curious about the details of how your implementation
              provides the standard library headers and fucntions, either check your
              implementation' s documentation or ask in a system-specific newsgroup.

              --
              Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
              San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
              We must do something. This is something. Therefore, we must do this.

              Comment

              • Richard Heathfield

                #8
                Re: standard libraries

                pete said:
                Jim Showalter wrote:
                >>
                >Does a hosted implementation require
                >any particular libraries in order to be
                >considered a standard C compiler?
                >
                Yes.
                >
                C89, hosted:
                <assert.h<local e.h<stddef.h>
                [etc]

                Those are not libraries. They're headers.

                <snip>

                --
                Richard Heathfield
                "Usenet is a strange place" - dmr 29/7/1999

                email: rjh at above domain (but drop the www, obviously)

                Comment

                • Richard Heathfield

                  #9
                  Re: standard libraries

                  pete said:
                  Richard Heathfield wrote:
                  >>
                  >Jim Showalter said:
                  >>
                  Does a hosted implementation require
                  any particular libraries in order to
                  be considered a standard C compiler?
                  >>
                  >A hosted implementation must provide
                  >all the standard library functions, but
                  >the Standard does not say in what form they must be provided.
                  >
                  Yes.
                  >
                  This directive in a C file: #include <float.h>
                  only means that the compiler has to compile the C file
                  as though float.h was pasted in there.
                  If that can be done without a float.h file being present,
                  then there doesn't need to be a float.h file
                  in the hosted implementation.
                  What has <float.hto do with libraries?

                  --
                  Richard Heathfield
                  "Usenet is a strange place" - dmr 29/7/1999

                  email: rjh at above domain (but drop the www, obviously)

                  Comment

                  • Malcolm

                    #10
                    Re: standard libraries

                    "Jim Showalter" <jim_showalter@ hotmail.comwrot e
                    >
                    Does a hosted implementation require any particular libraries in order to
                    be
                    considered a standard C compiler?
                    >
                    Yes. the standard library.
                    The problem is that most hosted implementations run on computers with
                    graphical user interfaces, and there are no standard library functions for
                    communicating with a GUI. Some evil systems also take away streams such as
                    stderr and stdout, which makes life very difficult.
                    --

                    freeware games to download.



                    Comment

                    • pete

                      #11
                      Re: standard libraries

                      Richard Heathfield wrote:
                      >
                      pete said:
                      >
                      Jim Showalter wrote:
                      >
                      Does a hosted implementation require
                      any particular libraries in order to be
                      considered a standard C compiler?
                      Yes.

                      C89, hosted:
                      <assert.h<local e.h<stddef.h>
                      >
                      [etc]
                      >
                      Those are not libraries. They're headers.
                      >
                      <snip>
                      Parts of the standard library,
                      are sometimes refered to as "libraries" ,
                      such as "the math library",
                      which is mentioned in the FAQ.



                      --
                      pete

                      Comment

                      • jacob navia

                        #12
                        Re: standard libraries

                        Jim Showalter wrote:
                        jacob navia wrote:
                        >
                        >>I suppose that the standard C library (at least) should be present.
                        >>In any case a compiler without any library is not very useful...
                        >>
                        >>jacob
                        >
                        >
                        That's what I thought, too. But I've installed the latest versions of MinGW
                        along with gcc-core, and cannot find even a mention of libc or glibc.
                        >
                        mingw doesn't have an own version of the standard C
                        Library and uses the implementation provided with the
                        operating system: crtdll.dll.

                        This rather ancient implementation will provide you with
                        C89 semantics with a compiler that can possible emit
                        C99 code, so take care as not to ask for anything
                        recent what standards is concerned.

                        At the same time, even if the compiler accepts and emits
                        code for long doubles, mingw doesn't have any library support
                        for long doubles so better not use them.

                        The same with long longs, since the printf version of crtdll.dll
                        doesn't understand any long long semantics. Maybe it understands
                        long long ll;
                        printf("%I64d\n ",ll);

                        but I am not sure about it.

                        Another possibility is that you make mingw link with the
                        C library of the microsoft compiler system, but I do
                        not know how to do that or if it is fair to do this (use
                        Microsoft's libraries without buying a copy of the
                        Microsoft compiler); See your lawyer for additional
                        information :-)

                        jacob

                        Comment

                        • Richard Heathfield

                          #13
                          Re: standard libraries

                          pete said:
                          Richard Heathfield wrote:
                          >>
                          >pete said:
                          >>
                          Jim Showalter wrote:
                          >>
                          >Does a hosted implementation require
                          >any particular libraries in order to be
                          >considered a standard C compiler?
                          >
                          Yes.
                          >
                          C89, hosted:
                          <assert.h<local e.h<stddef.h>
                          >>
                          >[etc]
                          >>
                          >Those are not libraries. They're headers.
                          >>
                          ><snip>
                          >
                          Parts of the standard library,
                          are sometimes refered to as "libraries" ,
                          Erroneously.
                          such as "the math library",
                          which is mentioned in the FAQ.
                          >
                          http://c-faq.com/fp/libm.html
                          If you read it more carefully, you'll see that the question addresses the
                          /difference/ between headers and libraries. When it's talking about "the
                          math library", it is talking about "actually linking with the math
                          *library*", not "linking with the <math.hheader ". You don't link with
                          headers.

                          --
                          Richard Heathfield
                          "Usenet is a strange place" - dmr 29/7/1999

                          email: rjh at above domain (but drop the www, obviously)

                          Comment

                          • those who know me have no need of my name

                            #14
                            Re: standard libraries

                            in comp.lang.c i read:

                            [re: platform provided standard c library]
                            >This rather ancient implementation will provide you with
                            >C89 semantics with a compiler that can possible emit
                            >C99 code, so take care as not to ask for anything
                            >recent what standards is concerned.
                            eh? decoder ring needed.
                            >At the same time, even if the compiler accepts and emits
                            >code for long doubles, mingw doesn't have any library support
                            >for long doubles so better not use them.
                            that would be sad then, since long double has been part of the language for
                            a long time [c89 3.1.2.5].

                            --
                            a signature

                            Comment

                            • jacob navia

                              #15
                              Re: standard libraries

                              those who know me have no need of my name wrote:
                              in comp.lang.c i read:
                              >
                              [re: platform provided standard c library]
                              >
                              >>This rather ancient implementation will provide you with
                              >>C89 semantics with a compiler that can possible emit
                              >>C99 code, so take care as not to ask for anything
                              >>recent what standards is concerned.
                              >
                              >
                              eh? decoder ring needed.
                              >
                              This means that the printf provided by crtdll.dll is strictly
                              C89 and doesn't provide any way of printing either
                              long doubles, long longs or any normal printf directives.

                              OK?
                              >
                              >>At the same time, even if the compiler accepts and emits
                              >>code for long doubles, mingw doesn't have any library support
                              >>for long doubles so better not use them.
                              >
                              >
                              that would be sad then, since long double has been part of the language for
                              a long time [c89 3.1.2.5].
                              >
                              Yes, but microsoft implemented long double as a
                              synonym for double. Since gcc has real long doubles
                              the library CRTDLL.DLL does NOT follow and you are stuck

                              Comment

                              Working...