looking for good C source code

Discussion in 'C Programming' started by Clark, Dec 26, 2003.

  1. Clark

    Clark Guest

    Hi all.
    I'm looking for good C source code to study and be able to advance my C
    programming skills. Do you recomend any open source project in particular
    that in your opinion has good writen C code?
    Thanks.
     
    Clark, Dec 26, 2003
    #1
    1. Advertising

  2. Clark

    stau Guest

    The Linux Kernel.
    www.kernel.org

    The best free (as in free speech) C code you can get.

    On Fri, 26 Dec 2003 20:31:43 +0000, Clark wrote:

    > Hi all.
    > I'm looking for good C source code to study and be able to advance my C
    > programming skills. Do you recomend any open source project in particular
    > that in your opinion has good writen C code?
    > Thanks.
     
    stau, Dec 27, 2003
    #2
    1. Advertising

  3. Clark

    Aaron Walker Guest

    stau wrote:
    > The Linux Kernel.
    > www.kernel.org
    >
    > The best free (as in free speech) C code you can get.


    I definitely had fun reading version 0.01 of the linux kernel. I
    decided to read that version because I figured it'd be the easiest to
    read and understand since it is a minimal kernel.

    Aaron
    --
    /usr/bin/fortune says:
    Taxes are not levied for the benefit of the taxed.
     
    Aaron Walker, Dec 27, 2003
    #3
  4. "Clark" <> wrote in
    news:bsianl$d0c41$-berlin.de on Fri 26 Dec 2003
    01:31:43p:

    > Hi all.
    > I'm looking for good C source code to study and be able to advance my C
    > programming skills. Do you recomend any open source project in
    > particular that in your opinion has good writen C code?
    > Thanks.
    >
    >


    This isn't really on-topic for this group. comp.programming would
    probably be a better place for it. comp.lang.c only deals with Standard
    C, not programming in general or languages other than Standard C.

    In any case, the GNU Project has released some coding standards for
    people to follow. I think they can be applied generally, in fact, and so
    I will give you the link to the website where they are listed:

    http://www.gnu.org/prep/standards_toc.html

    Another thing for you to keep in mind is the difference between using a
    specific language and programming in general.

    Using a language is all about knowing syntax rules and taking advantage
    of semantics and such like. In other words, it's not applicable to any
    other language.

    Programming in general deals with algorithm design and structuring of
    both code and data and the theory of effective computability. In other
    words, it is completely independent of any language.

    Perhaps the most important lesson in programming style to take from that
    distinction is to learn that structure and planning are the most
    important elements of good style, and that they will show through well no
    matter what language you use.
     
    August Derleth, Dec 27, 2003
    #4
  5. Clark

    Randy Howard Guest

    In article <>,
    says...
    > The Linux Kernel.
    > www.kernel.org
    >
    > The best free (as in free speech) C code you can get.


    It's free, but it's not C.

    The linux kernel uses a lot of gcc extensions that are not pure ISO
    or ANSI standard C. That's not bad, it would be hard to write an OS
    without doing so, but if your intent is to learn portable C, that's
    probably not the place to start.

    Sourceforge is a great reasource, try searching for ANSI and ISO and
    reading project summaries for those claiming to be fully portable.

    Also, several of the regular posters here have websites with
    libraries and smaller code samples that are fully portable, try
    trolling through some of the .sig lines.

    --
    Randy Howard
    2reply remove FOOBAR
     
    Randy Howard, Dec 27, 2003
    #5
  6. Clark wrote:

    > Hi all.
    > I'm looking for good C source code to study and be able to advance my C
    > programming skills. Do you recomend any open source project in particular
    > that in your opinion has good writen C code?



    (I must disagree with August Derleth about the topicality of this question.
    I can think of no better place to ask about good C source code than a good
    C newsgroup!)


    If you're looking for good C source code, look no further than comp.lang.c.
    If you want to advance your C programming skills, you are already at the
    right place. Read the group regularly, and (once you have worked out who
    knows what they're talking about and who doesn't) you'll pick up a vast
    number of useful tips on how to use the language correctly and skilfully.

    You don't have to wait for discussions to happen, either, since Google has
    archives for this newsgroup going back to - er, no, it even goes back
    further than that.

    A brief, non-exhaustive list of names worth looking out for (past and
    present) - every one of these people is a C expert:

    Martin Ambuhl
    Christian Bau
    Dann Corbit
    Douglas Gwyn
    Lawrence Kirby
    Jack Klein
    Ben Pfaff
    P J Plauger
    Dan Pop
    "Noone Really"
    Will Rose
    Eric Sosman
    Richard Stamp
    Keith Thompson
    Chris Torek
    Stephan Wilms
    Dik Winter

    Like I said, it's non-exhaustive. But basically, if you focus on articles by
    these people, you'll pick up a lot of good stuff. Then find out who agrees
    with them (on the whole!), and you'll find your way to other clueful
    articles.

    It's not the best way to /learn/ C, by any means, but if you've already
    "learned" C, this is a great way to find out what you got wrong and what
    you missed.


    --
    Richard Heathfield :
    "Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
    C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
    K&R answers, C books, etc: http://users.powernet.co.uk/eton
     
    Richard Heathfield, Dec 27, 2003
    #6
  7. Clark

    Sidney Cadot Guest

    Richard Heathfield wrote:

    > [snip]


    > A brief, non-exhaustive list of names worth looking out for (past and
    > present) - every one of these people is a C expert:
    >
    > Martin Ambuhl
    > Christian Bau
    > Dann Corbit
    > Douglas Gwyn
    > Lawrence Kirby
    > Jack Klein
    > Ben Pfaff
    > P J Plauger
    > Dan Pop
    > "Noone Really"
    > Will Rose
    > Eric Sosman
    > Richard Stamp
    > Keith Thompson
    > Chris Torek
    > Stephan Wilms
    > Dik Winter
    >
    > Like I said, it's non-exhaustive. But basically, if you focus on articles by
    > these people, you'll pick up a lot of good stuff. Then find out who agrees
    > with them (on the whole!), and you'll find your way to other clueful
    > articles.


    This list is especially non-exhaustive in that it omits Mr. Heatfield
    himself, of course.

    A rather funny thought just occurred to me: what would happen if people
    of this caliber got together to work on a real-life project? Seems that
    a mediocre outcome is out of the question... Either the result would be
    quite brilliant or a total deadlock, I think :)

    > It's not the best way to /learn/ C, by any means, but if you've already
    > "learned" C, this is a great way to find out what you got wrong and what
    > you missed.


    It certainly is.

    Best regards, Sidney
     
    Sidney Cadot, Dec 27, 2003
    #7
  8. Clark

    stau Guest

    On Sat, 27 Dec 2003 02:21:28 +0000, Aaron Walker wrote:

    > stau wrote:
    >> The Linux Kernel.
    >> www.kernel.org
    >>
    >> The best free (as in free speech) C code you can get.

    >
    > I definitely had fun reading version 0.01 of the linux kernel. I
    > decided to read that version because I figured it'd be the easiest to
    > read and understand since it is a minimal kernel.
    >
    > Aaron


    Its does have some bugs on the use of the C language, as Linus just
    admited when argumenting against SCO dick corp.; like #define
    someMacro(a, b) (a - b), in which the argument may be a complex
    expression.
    A newer version is probably better for study.
     
    stau, Dec 27, 2003
    #8
  9. Clark

    Servé Lau Guest

    "Sidney Cadot" <> wrote in message
    news:bsjtu2$jde$...
    > A rather funny thought just occurred to me: what would happen if people
    > of this caliber got together to work on a real-life project? Seems that
    > a mediocre outcome is out of the question... Either the result would be
    > quite brilliant or a total deadlock, I think :)


    I do agree that the people mentioned know their stuff very well, but you
    need more than only coding and language skills to successfully complete a
    big project.
     
    Servé Lau, Dec 27, 2003
    #9
  10. "Servé Lau" <> wrote in message
    news:bskdep$cog$1.nb.home.nl...
    > "Sidney Cadot" <> wrote in message
    > news:bsjtu2$jde$...
    > > A rather funny thought just occurred to me: what would happen if people
    > > of this caliber got together to work on a real-life project? Seems that
    > > a mediocre outcome is out of the question... Either the result would be
    > > quite brilliant or a total deadlock, I think :)

    >
    > I do agree that the people mentioned know their stuff very well, but you
    > need more than only coding and language skills to successfully complete a
    > big project.


    I'm quite sure the listed people would know quite a lot of other stuff too.
    :)

    But more critically, a group considering a project that would actually
    _need_
    more than two (say) genuine C _experts_ should probably reconsider it's
    choice
    of programming language! ;)

    In any case, many of the listed people _have_ colaborated on a real-life
    project: "C Unleashed". Although, Francis Glassborow wasn't entirely
    convinced of the merits of that project, even if he was satisfied with
    the quality of production.

    --
    Peter
     
    Peter Nilsson, Dec 27, 2003
    #10
  11. Peter Nilsson wrote:

    > But more critically, a group considering a project that would actually
    > _need_ more than two (say) genuine C _experts_ should probably
    > reconsider it's choice of programming language! ;)


    Or perhaps a group that thinks it can get away with using non-experts should
    be designing street-signs instead of software.

    > In any case, many of the listed people _have_ colaborated on a real-life
    > project: "C Unleashed". Although, Francis Glassborow wasn't entirely
    > convinced of the merits of that project, even if he was satisfied with
    > the quality of production.


    I hold the opposite position to Francis. I think the project was worth
    doing, but I think the timescales involved made it more or less impossible
    to provide the kind of quality we'd have been happy with. On the other
    hand, perfectionists are /never/ happy with the quality, are they? And if
    there's one thing (other than C) that unites clc regs, it's perfectionism.

    --
    Richard Heathfield :
    "Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
    C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
    K&R answers, C books, etc: http://users.powernet.co.uk/eton
     
    Richard Heathfield, Dec 27, 2003
    #11
  12. "Richard Heathfield" <> wrote in message
    news:bskl56$j0g$...
    > And if
    > there's one thing (other than C) that unites clc regs, it's perfectionism.


    s/rfectionism/dantry ;-)

    Seriously, I think CU is a good book. It may have been knocked up in limited
    time, but that only shows more about the quality of its authors. It's not a
    beginners' book after all, and the others care more about the content than
    anything else.
     
    Peter Pichler, Dec 27, 2003
    #12
  13. On Fri, 26 Dec 2003 15:31:43 -0500, Clark wrote:

    > Hi all.
    > I'm looking for good C source code to study and be able to advance my C
    > programming skills. Do you recomend any open source project in
    > particular that in your opinion has good writen C code? Thanks.


    Here's my open source "toolbelt" of code:

    http://www.ioplex.com/~miallen/libmba/dl/src/

    Regarding it's quality; most of the modules are ANSI C so other than that
    quality is a matter of opinion. Or it depends on what you're using the
    code for. Condsider the stack.c module for example. It was developed with
    the assistance of people on this newsgroup several years ago and helped
    define my style. However it is a general purpose ADT that automatically
    grows and shrinks as memory requirements change. It also checks parameters
    and sets errno. These are things that would not be appropriate in some
    cases. Some simple PUSH/POP macros would certainly be more efficient.

    Mike
     
    Michael B Allen, Dec 28, 2003
    #13
  14. Clark

    CBFalconer Guest

    Sidney Cadot wrote:
    > Richard Heathfield wrote:
    >
    > > [snip]

    >
    > A rather funny thought just occurred to me: what would happen if
    > people of this caliber got together to work on a real-life project?
    > Seems that a mediocre outcome is out of the question... Either the
    > result would be quite brilliant or a total deadlock, I think :)


    The book "C Unleashed", by Heathfield et al, is a fairly recent
    example.

    --
    Chuck F () ()
    Available for consulting/temporary embedded and systems.
    <http://cbfalconer.home.att.net> USE worldnet address!
     
    CBFalconer, Dec 28, 2003
    #14
  15. Clark

    Ed Morton Guest

    Richard Heathfield wrote:
    > Peter Nilsson wrote:
    >
    >
    >>But more critically, a group considering a project that would actually
    >>_need_ more than two (say) genuine C _experts_ should probably
    >>reconsider it's choice of programming language! ;)

    >
    >
    > Or perhaps a group that thinks it can get away with using non-experts should
    > be designing street-signs instead of software.


    In at least some applications, and I'd suspect most, the benefits of C
    expertise are a drop in ocean compared to expertise in the domain that's
    using C.

    Given the choice of a domain expert with limitted C knowledge and a C
    expert with limitted domain knowledge, I'd certainly choose the domain
    expert.

    Ed.
     
    Ed Morton, Dec 28, 2003
    #15
  16. Ed Morton wrote:

    >
    >
    > Richard Heathfield wrote:
    >> Peter Nilsson wrote:
    >>
    >>
    >>>But more critically, a group considering a project that would actually
    >>>_need_ more than two (say) genuine C _experts_ should probably
    >>>reconsider it's choice of programming language! ;)

    >>
    >>
    >> Or perhaps a group that thinks it can get away with using non-experts
    >> should be designing street-signs instead of software.

    >
    > In at least some applications, and I'd suspect most, the benefits of C
    > expertise are a drop in ocean compared to expertise in the domain that's
    > using C.
    >
    > Given the choice of a domain expert with limitted C knowledge and a C
    > expert with limitted domain knowledge, I'd certainly choose the domain
    > expert.


    Frankly, given the same choice, so would I - and I might even consider
    switching the project language to that favoured by the domain expert.

    Interestingly, in most of /my/ programming career, the critical domain has
    been C itself.

    --
    Richard Heathfield :
    "Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
    C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
    K&R answers, C books, etc: http://users.powernet.co.uk/eton
     
    Richard Heathfield, Dec 28, 2003
    #16
  17. On Sat, 27 Dec 2003 22:09:10 -0600, in comp.lang.c , Ed Morton
    <> wrote:

    >
    >
    >Richard Heathfield wrote:
    >>
    >> Or perhaps a group that thinks it can get away with using non-experts should
    >> be designing street-signs instead of software.

    >
    >Given the choice of a domain expert with limitted C knowledge and a C
    >expert with limitted domain knowledge, I'd certainly choose the domain
    >expert.


    Hmm. Sounds like a microsoftian saying, or do you work in Dilbert's
    office? :)

    Lets face it, if you had a choice of either one or the other, your
    project is already doomed. You don't know enough C to write hte
    programme well, or you don't know enough about your requirements
    domain to design it in the first place... argh.

    --
    Mark McIntyre
    CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
    CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>


    ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
    ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
     
    Mark McIntyre, Dec 28, 2003
    #17
  18. Mark McIntyre wrote:
    > Ed Morton wrote:
    >>Richard Heathfield wrote:
    >>>
    >>> Or perhaps a group that thinks it can get away with using non-experts
    >>> should be designing street-signs instead of software.

    >>
    >>Given the choice of a domain expert with limitted C knowledge and a C
    >>expert with limitted domain knowledge, I'd certainly choose the domain
    >>expert.

    >
    > Hmm. Sounds like a microsoftian saying, or do you work in Dilbert's
    > office? :)
    >
    > Lets face it, if you had a choice of either one or the other, your
    > project is already doomed. You don't know enough C to write hte
    > programme well, or you don't know enough about your requirements
    > domain to design it in the first place... argh.


    It doesn't have to be that stark a choice. Expertise is not a Boolean
    concept. It is possible to know enough about a domain to do useful work in
    it without necessarily being an expert in that domain, as long as real
    expertise is somehow available to you when required (co-worker, good book,
    whatever). Similarly, it is possible to know enough about C to do useful
    work in it without necessarily being a C expert.

    If you're good at picking your team, you'll have C experts AND domain
    experts, who will learn from each other as the project progresses.

    --
    Richard Heathfield :
    "Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
    C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
    K&R answers, C books, etc: http://users.powernet.co.uk/eton
     
    Richard Heathfield, Dec 28, 2003
    #18
  19. Clark

    Servé Lau Guest

    "Peter Nilsson" <> wrote in message
    news:3fedc775$...
    > But more critically, a group considering a project that would actually
    > _need_
    > more than two (say) genuine C _experts_ should probably reconsider it's
    > choice
    > of programming language! ;)


    Something just occurred to me. Suppose a group of C experts clc style would
    start out to create a windows program with Win32 and C. I think they would
    be stressed out in a matter of weeks :)
    Threads, writing to the registry, shoving windows around, dll's, that's not
    portable!
    _stdcall, _cdecl, casting longs to function pointers, WPARAM to CREATESTRUCT
    * and a second time to int, oh my!
     
    Servé Lau, Dec 28, 2003
    #19
  20. Clark

    John L Guest

    "Servé Lau" <> wrote in message news:bsn62b$1fv$1.nb.home.nl...
    > "Peter Nilsson" <> wrote in message
    > news:3fedc775$...
    > > But more critically, a group considering a project that would actually
    > > _need_
    > > more than two (say) genuine C _experts_ should probably reconsider it's
    > > choice
    > > of programming language! ;)

    >
    > Something just occurred to me. Suppose a group of C experts clc style would
    > start out to create a windows program with Win32 and C. I think they would
    > be stressed out in a matter of weeks :)
    > Threads, writing to the registry, shoving windows around, dll's, that's not
    > portable!
    > _stdcall, _cdecl, casting longs to function pointers, WPARAM to CREATESTRUCT
    > * and a second time to int, oh my!
    >
    >


    More likely they would keep separate the platform-specific and
    non-portable code from "official clc-approved ISO Standard C" code.

    That way, when they, or their successors in eighteen months time,
    come to port the program to a different platform or simply just
    a different compiler or graphics library, it would be obvious
    which parts need to be changed and which do not.

    And after the port, they'd still have the portable, standard bit,
    but now there would be two different (non-portable) modules
    interfacing to two different platforms or databases or window
    systems or whatever.

    But, not being an expert, I'm just guessing. :)

    John.
     
    John L, Dec 28, 2003
    #20
    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. Replies:
    1
    Views:
    355
  2. Replies:
    15
    Views:
    419
    Randy Howard
    Mar 28, 2006
  3. cowznofsky
    Replies:
    2
    Views:
    462
    cowznofsky
    Oct 2, 2008
  4. nntpman68
    Replies:
    7
    Views:
    616
  5. Replies:
    1
    Views:
    88
Loading...

Share This Page