Re: C library and C implement

Discussion in 'C Programming' started by James Kuyper, Jan 1, 2014.

  1. James Kuyper

    James Kuyper Guest

    On 01/01/2014 09: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?


    A C library is used to package together a bunch of C modules for
    convenient linking, just as an ordinary library packages together a
    bunch of books for easy selection.

    There is one particular library, not necessarily containing C modules
    (many of them are often written in other languages, such as assembler)
    that is of special importance to C programmers. That's because the
    library is mandated by the C standard.

    The C standard library contains many different functions, for many
    different purposes. Some of them provide a standard interface to system
    features such files, memory, threading, etc., so you won't have to write
    different code for each platform you port your code to. Some of them are
    utility routine working with strings and arrays that are typically
    interfaces to highly optimized assembly language that can be more
    efficient than any platform-independent pure C code can be. A large part
    of the library is floating point math routines.

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


    A conforming implementation of C must include an implementation of the C
    standard library.

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


    POSIX is an operating system standard. Among the many things that
    standard mandates is the existence of various POSIX library functions, a
    C compiler, a C standard library, and a linker. In addition, POSIX
    mandates specific things about the C implementation that the C standard
    itself leaves unspecified, such as CHAR_BIT==8. Many POSIX library
    routines are mandated to be packaged in with the C standard library
    routines.

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


    I don't know enough about MSVC to comment on the differences. Others
    will be able to answer that question better than I.

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


    Start working the exercises in any decent C text book. C was my fourth
    computer programming language, and I learned it easily from "The C
    programming Language" by Kernighan & Ritchie, but I've been told that
    it's not as good a text book for people who are learning C as their
    first programming language.
    You can't do much of anything useful in C without a C standard library
    function being involved somewhere. At the very least, if you read any
    input or write any output you'll generally need to use the <stdio.h>
    library.

    > sorry if these questions are idiotic.


    There is such a thing as a stupid question, but those aren't examples.
    Asking about something you don't know is smart, not stupid.
    --
    James Kuyper
    James Kuyper, Jan 1, 2014
    #1
    1. Advertising

  2. James Kuyper

    Matt Guest

    On 02/01/14 05:27, James Kuyper wrote:
    >> 5. How can I do some real programming with a C library?

    > Start working the exercises in any decent C text book. C was my fourth
    > computer programming language, and I learned it easily from "The C
    > programming Language" by Kernighan & Ritchie, but I've been told that
    > it's not as good a text book for people who are learning C as their
    > first programming language.


    Finding a decent C book other than kr2 can be easier said than done. C
    was kind of (but not really) my first language. I mixed it up with side
    journeys into python, objc, c++ with qt libraries ... One thing I've
    found consistently helpful throughout is Steve Summit's course material
    so I would recommend it to the OP. I've had it on my hard drive for
    years so I forget the url but he can probably find it from the clc wiki
    or by googling.
    Matt, Jan 1, 2014
    #2
    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:
    712
    Gerald
    Dec 9, 2005
  2. Gerald
    Replies:
    5
    Views:
    457
  3. osmium

    Re: C library and C implement

    osmium, Jan 1, 2014, in forum: C Programming
    Replies:
    1
    Views:
    94
    Keith Thompson
    Jan 1, 2014
  4. Eric Sosman

    Re: C library and C implement

    Eric Sosman, Jan 1, 2014, in forum: C Programming
    Replies:
    0
    Views:
    102
    Eric Sosman
    Jan 1, 2014
  5. Malcolm McLean

    Re: C library and C implement

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

Share This Page