Re: C library and C implement

Discussion in 'C Programming' started by Eric Sosman, Jan 1, 2014.

  1. Eric Sosman

    Eric Sosman Guest

    On 1/1/2014 9:31 AM, gyl wrote:
    > I am not cleared with the concept of "language library" and "language
    > implement".
    > Here are my questions:
    > 1. what is a C library used for?


    To accomplish things that can't be done in unaided C itself,
    or things that would be tedious and expensive if you had to re-
    implement them for every program that needed them. For an example
    of the first, consider the exit() function: The incantations that
    shut down programs in Windows, Unix, i5/OS, OpenVMS, ... are all
    different, and can't be done given only `for' and `switch' and so
    on. For an example of the latter, consider the atan2() function:
    It is more convenient (and less costly, and less error-prone) to
    use the pre-written and pre-tested atan2() function from the library
    than to write your own arctangent every time you need one.

    > 2. Is it true that a C implement contains a C library?


    Every hosted C implementation provides the library functions
    (and macros and so on) specified by the Standard. Many provide
    additional libraries for things like graphics or networking or
    other areas not addressed by the Standard.

    A "freestanding" C implementation need not provide all of the
    Standard library; indeed, it might provide none at all.

    > 3. What is POSIX? is it a library standard?


    There's lots of information at <http://lmgtfy.com/?q=POSIX>.

    > 4. What is the difference between glibc and MSVC's c runtime library?


    What is the difference between a Ford and a Jeep? Both are
    automobiles, but built by different companies and with different
    purposes and audiences in mind.

    > 5. How can I do some real programming with a C library?


    Write C, and you'll find yourself using the Standard library
    as soon as you call printf() -- or exit(), or sqrt(), or malloc(),
    or ...

    Using other libraries -- whether provided by third parties or
    composed of your own components -- depends a lot on the environment:
    Different tool sets have different ways of saying "Put this into my
    program, please." In most C environments, your source code will use
    the #include directive to obtain the compile-time declarations and
    stuff that the library components need, and at "link time" you will
    indicate where the pre-compiled library can be found. Variations
    abound.

    --
    Eric Sosman
    d
    Eric Sosman, Jan 1, 2014
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gerald
    Replies:
    0
    Views:
    699
    Gerald
    Dec 9, 2005
  2. Gerald
    Replies:
    5
    Views:
    452
  3. osmium

    Re: C library and C implement

    osmium, Jan 1, 2014, in forum: C Programming
    Replies:
    1
    Views:
    88
    Keith Thompson
    Jan 1, 2014
  4. James Kuyper

    Re: C library and C implement

    James Kuyper, Jan 1, 2014, in forum: C Programming
    Replies:
    1
    Views:
    109
  5. Malcolm McLean

    Re: C library and C implement

    Malcolm McLean, Jan 1, 2014, in forum: C Programming
    Replies:
    3
    Views:
    97
    Malcolm McLean
    Jan 3, 2014
Loading...

Share This Page