Repository of C code

Discussion in 'C Programming' started by Khookie, Dec 21, 2007.

  1. Khookie

    Khookie Guest

    Hi everyone

    I was at an open source conference in Brisbane, Australia not so long
    ago, and I can recall a few individuals discussing starting up a C
    equivalent of CPAN (i.e. a large centralised repository of C code).

    So I thought I might ask people on clc - whether such a thing exists
    already?

    Chris
    Khookie, Dec 21, 2007
    #1
    1. Advertising

  2. Khookie

    santosh Guest

    Khookie wrote:

    > Hi everyone
    >
    > I was at an open source conference in Brisbane, Australia not so long
    > ago, and I can recall a few individuals discussing starting up a C
    > equivalent of CPAN (i.e. a large centralised repository of C code).
    >
    > So I thought I might ask people on clc - whether such a thing exists
    > already?


    snippets.org
    santosh, Dec 21, 2007
    #2
    1. Advertising

  3. Khookie

    Paul Hsieh Guest

    On Dec 20, 9:05 pm, Khookie <> wrote:
    > Hi everyone
    >
    > I was at an open source conference in Brisbane, Australia not so long
    > ago, and I can recall a few individuals discussing starting up a C
    > equivalent of CPAN (i.e. a large centralised repository of C code).
    >
    > So I thought I might ask people on clc - whether such a thing exists
    > already?


    Not really. There just isn't any culture for that sort of thing in
    the C programming language. You need only look to the C library to
    see how the language encourages mediocrity error, with no regard to
    scalability or robustness. I mean what would such a collection be
    building on top of?

    I've written a few things here and there that some people have taken
    up (a string library, a stdint.h replacement, some square root code, a
    CSV parser and a hash function that people apparently can't get enough
    of.) Ben Pfaff has written some Red-Black tree thing that apparently
    gets used. But there just doesn't seem to be a critical mass of such
    stuff that's enough for people to want to put it together to continue
    to build/support a culture for C programming. C has really just
    become a language for (embedded) systems drivers and virus writers.

    You would probably be happier with C++. They started with STL, and a
    lot has been added via "Boost". The way forward with C can only be
    through C++. C itself is basically heading in the direction of COBOL,
    and thus its hard to motivate a community to build something like CPAN
    or Boost for it.

    --
    Paul Hsieh
    http://www.pobox.com/~qed/
    http://bstring.sf.net/
    Paul Hsieh, Dec 21, 2007
    #3
  4. On Dec 21, 12:40 am, Paul Hsieh <> wrote:
    > On Dec 20, 9:05 pm, Khookie <> wrote:
    >
    > > Hi everyone

    >
    > > I was at an open source conference in Brisbane, Australia not so long
    > > ago, and I can recall a few individuals discussing starting up a C
    > > equivalent of CPAN (i.e. a large centralised repository of C code).

    >
    > > So I thought I might ask people on clc - whether such a thing exists
    > > already?

    >
    > Not really.  There just isn't any culture for that sort of thing in
    > the C programming language.  You need only look to the C library to
    > see how the language encourages mediocrity error, with no regard to
    > scalability or robustness.  I mean what would such a collection be
    > building on top of?


    Not to mention the problem of coming up with even a loose standard for
    packaging and build information that everyone will be happy with. Not
    even 'make' is portable enough, I think. The Windows guys want
    something that Visual Studio, Dev-C++, or MinGW can build (depending);
    the Unix guys want make(1)files and don't like being told not to use
    POSIX, and the end users just want pretty 3D effects...

    > I've written a few things here and there that some people have taken
    > up (a string library, a stdint.h replacement, some square root code, a
    > CSV parser and a hash function that people apparently can't get enough
    > of.)  Ben Pfaff has written some Red-Black tree thing that apparently
    > gets used.  But there  just doesn't seem to be a critical mass of such
    > stuff that's enough for people to want to put it together to continue
    > to build/support a culture for C programming.  C has really just
    > become a language for (embedded) systems drivers and virus writers.


    But have you written an obscenely-fast blit-scale algorithm in
    assembler yet that beats my Cyrix-tuned implementation by a factor of
    2? ;)

    > You would probably be happier with C++.  They started with STL, and a
    > lot has been added via "Boost".  The way forward with C can only be
    > through C++.  C itself is basically heading in the direction of COBOL,
    > and thus its hard to motivate a community to build something like CPAN
    > or Boost for it.


    There is probably room in the C community for a project like Boost,
    but it would, at least initially, need very strong and motivated
    leadership, for two reasons. One, to write the initial family of
    libraries and set an example of the level of excellence (or lack
    thereof) expected, and two, to keep the project moving. C is not
    dead, but it's rather unlikely that The C Community, fragmented as it
    is between vendors and platforms, will suddenly pull together without
    some seed to start from.
    Owen Jacobson, Dec 21, 2007
    #4
  5. Paul Hsieh said:

    > On Dec 20, 9:05 pm, Khookie <> wrote:
    >> Hi everyone
    >>
    >> I was at an open source conference in Brisbane, Australia not so long
    >> ago, and I can recall a few individuals discussing starting up a C
    >> equivalent of CPAN (i.e. a large centralised repository of C code).
    >>
    >> So I thought I might ask people on clc - whether such a thing exists
    >> already?

    >
    > Not really.


    And Snippets doesn't count because...?

    --
    Richard Heathfield <http://www.cpax.org.uk>
    Email: -http://www. +rjh@
    Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
    "Usenet is a strange place" - dmr 29 July 1999
    Richard Heathfield, Dec 21, 2007
    #5
  6. Khookie

    santosh Guest

    Richard Heathfield wrote:

    > Paul Hsieh said:
    >
    >> On Dec 20, 9:05 pm, Khookie <> wrote:
    >>> Hi everyone
    >>>
    >>> I was at an open source conference in Brisbane, Australia not so
    >>> long ago, and I can recall a few individuals discussing starting up
    >>> a C equivalent of CPAN (i.e. a large centralised repository of C
    >>> code).
    >>>
    >>> So I thought I might ask people on clc - whether such a thing exists
    >>> already?

    >>
    >> Not really.

    >
    > And Snippets doesn't count because...?


    Presumably they are not "professional" enough. :)

    Seriously though, there exists C code for doing just about anything, but
    something like CPAN or Boost hasn't emerged, perhaps for various
    reasons. Close alternatives are GLib and Apache Portable Runtime.

    C culture predates Internet and the "integrated solutions" that are very
    popular for the past two decades. Additionally, C is strongly
    influenced by UNIX, which encourages a mix and match "toolbox"
    approach, rather than comprehensive solutions.

    Despite this, something like Boost or CPAN would be very useful, but
    it's unlikely to happen.
    santosh, Dec 21, 2007
    #6
  7. santosh said:

    <snip>

    > Seriously though, there exists C code for doing just about anything


    Right. So perhaps all that is needed is a Well-Known Portal.

    <snip>

    --
    Richard Heathfield <http://www.cpax.org.uk>
    Email: -http://www. +rjh@
    Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
    "Usenet is a strange place" - dmr 29 July 1999
    Richard Heathfield, Dec 21, 2007
    #7
  8. Khookie

    Paul Hsieh Guest

    On Dec 21, 1:37 am, Richard Heathfield <> wrote:
    > Paul Hsieh said:
    >
    > > On Dec 20, 9:05 pm, Khookie <> wrote:
    > >> Hi everyone

    >
    > >> I was at an open source conference in Brisbane, Australia not so long
    > >> ago, and I can recall a few individuals discussing starting up a C
    > >> equivalent of CPAN (i.e. a large centralised repository of C code).

    >
    > >> So I thought I might ask people on clc - whether such a thing exists
    > >> already?

    >
    > > Not really.

    >
    > And Snippets doesn't count because...?


    Because I've never seen a snippet of code on that site that I didn't
    think was either totally trivial, or which I preferred to rewrite
    myself? Plus there's no structure or common idioms or direction that
    that codebase represents. I don't know much about CPAN, but STL and
    Boost are unified under a single source base, and present algorithms
    and templates that can work well together in a sensible and scalable
    way.

    If all you want is code snippets in C, then koders.com or www.google.com/codesearch
    is your answer. But I hardly see how those are useful in the same way
    that STL or Boost or CPAN is.

    --
    Paul Hsieh
    http://www.pobox.com/~qed/
    http://bstring.sf.net/
    Paul Hsieh, Dec 21, 2007
    #8
  9. Khookie

    Chris Hills Guest

    In article
    <>,
    Khookie <> writes
    >Hi everyone
    >
    >I was at an open source conference in Brisbane, Australia not so long
    >ago, and I can recall a few individuals discussing starting up a C
    >equivalent of CPAN (i.e. a large centralised repository of C code).
    >
    >So I thought I might ask people on clc - whether such a thing exists
    >already?
    >
    >Chris


    No it doesn't.

    C has been around for so long and is used for so many different things
    that there are many repositories for C code. Many run their own
    libraries and examples most of the MCU vendors, compiler makers, dev kit
    makers, various web sites for specific things like CAN or 8051.com

    The C community is far to big and diverse to centralise and many would
    not want to do it anyway.



    --
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
    /\/\/ www.phaedsys.org \/\/\
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    Chris Hills, Dec 21, 2007
    #9
  10. Khookie

    user923005 Guest

    On Dec 21, 1:55 am, Richard Heathfield <> wrote:
    > santosh said:
    >
    > <snip>
    >
    > > Seriously though, there exists C code for doing just about anything

    >
    > Right. So perhaps all that is needed is a Well-Known Portal.
    >
    > <snip>


    C collections are scattered all over the place. You have to look for
    numerical code in one place and data structures code in another, etc.
    I usually start with Sourceforge when I want to find something and
    then switch to google for some more hunting. When those fail, I have
    a few dozen other places to look.

    I think that the reason CPAN and BOOST don't exist for C is that it is
    almost impossible to create them. We had this discussion before about
    creating a generic data structures and algorithm library for C ["C
    needs a BOOST"], and the general consensus was that it was too
    difficult. With Perl and C++ there are generic fascilities for
    creation of algorithms and data structures that make this sort of
    thing much more feasible. That is why you will *never* see a CPAN
    sort of repository for C. It can't be done.
    user923005, Dec 21, 2007
    #10
  11. user923005 said:

    > C collections are scattered all over the place. You have to look for
    > numerical code in one place and data structures code in another, etc.


    Hence my suggestion for a single Well-Known Portal - so well-known that
    everyone would know to try it first when looking for libs.

    > I think that the reason CPAN and BOOST don't exist for C is that it is
    > almost impossible to create them. We had this discussion before about
    > creating a generic data structures and algorithm library for C ["C
    > needs a BOOST"], and the general consensus was that it was too
    > difficult.


    The library is easy. It's the consensus that's difficult. Getting everyone
    to agree on an interface is a Sisyphean task.

    > With Perl and C++ there are generic fascilities for
    > creation of algorithms and data structures that make this sort of
    > thing much more feasible. That is why you will *never* see a CPAN
    > sort of repository for C. It can't be done.


    The obstacles are not technical, but political.

    --
    Richard Heathfield <http://www.cpax.org.uk>
    Email: -http://www. +rjh@
    Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
    "Usenet is a strange place" - dmr 29 July 1999
    Richard Heathfield, Dec 21, 2007
    #11
  12. "Richard Heathfield" <> wrote in message
    >
    > The library is easy. It's the consensus that's difficult. Getting everyone
    > to agree on an interface is a Sisyphean task.
    >

    There's oodles of code on my site.
    Recently someone ported the BASIC interpreter to an embedded platform. I've
    had a couple of thanks for the options parser and csv file loader, and
    someone else asked for the source to suicide chess, which I hadn't posted.

    However the number of hits on the source files is never very high, and it is
    hard to know what is actually useful.

    --
    Free games and programming goodies.
    http://www.personal.leeds.ac.uk/~bgy1mm
    Malcolm McLean, Dec 21, 2007
    #12
  13. Khookie

    user923005 Guest

    On Dec 21, 1:42 pm, Richard Heathfield <> wrote:
    > user923005 said:
    >
    > > C collections are scattered all over the place.  You have to look for
    > > numerical code in one place and data structures code in another, etc.

    >
    > Hence my suggestion for a single Well-Known Portal - so well-known that
    > everyone would know to try it first when looking for libs.
    >
    > > I think that the reason CPAN and BOOST don't exist for C is that it is
    > > almost impossible to create them.  We had this discussion before about
    > > creating a generic data structures and algorithm library for C ["C
    > > needs a BOOST"], and the general consensus was that it was too
    > > difficult.

    >
    > The library is easy. It's the consensus that's difficult. Getting everyone
    > to agree on an interface is a Sisyphean task.


    But that's just it -- writing an algorithm with a generic interface in
    C is a difficult task.
    I can write an algorithm that works on an array of doubles. But will
    the same algorithm work on a linked list of structs?
    In C++, the STL gives you iterators so that diverse types of lists
    work the same. And templates give the ability to make the data object
    generic.
    In order to accomplish the same thing in C, I think you have to write
    a new version for different implementations or at least jump through a
    bunch of hoops.
    The reason that there has been consensus in C++ is that designing a
    functional interface in that language is easy due to the fascilities
    of the language.
    If it were just as easy in C, someone would have done it by now.
    Especially since C has been around much longer than C++.

    > > With Perl and C++ there are generic fascilities for
    > > creation of algorithms and data structures that make this sort of
    > > thing much more feasible.  That is why you will *never* see a CPAN
    > > sort of repository for C.  It can't be done.

    >
    > The obstacles are not technical, but political.


    I think that both kinds of obstacles exist, and the technical ones are
    bigger.

    Another advantage of C++ for this sort of thing is abstraction. Sure,
    it's just syntactic sugar, but if syntactic sugar were not important
    we would all code in assembly.
    For instance,

    if (a < b) {/* do stuff */}

    compared to:

    if (compare(a,b) < 0) {/* do stuff */}

    hardly seems any simpler. But when you have a page full of this kind
    of stuff, it becomes much easier to grasp in the more compact
    notation. Now, in C++ we are going to have to write a whole MESS of
    operator overloads to get the same functionality as a compare()
    function:
    operator <
    operator <=
    operator ==
    operator >=
    operator >
    operator !=
    but once you have done the work, the ease in notation makes
    programming more natural. I realize with trivial examples the
    statement sounds silly (e.g. up above, nobody will have difficulty
    with either comparison). But when you have pages and pages of this
    stuff (consider an extended precision number class verses an extended
    precision C library) it is definitely worth it.

    Now, I will grant you that *anything* you can do in C++ *could* also
    be done in C {or assembly, for that matter}. But the added level of
    difficulty means that it probably won't be anyway -- even though it
    may be possible.
    I would absolutely *love* to be proven wrong about this and wake up
    some morning to find an STL and BOOST equivalent for C. But I
    certainly am not going to hold my breath waiting for it.
    user923005, Dec 21, 2007
    #13
  14. Khookie

    CBFalconer Guest

    Chris Hills wrote:
    > Khookie <> writes
    >>
    >> I was at an open source conference in Brisbane, Australia not so
    >> long ago, and I can recall a few individuals discussing starting
    >> up a C equivalent of CPAN (i.e. a large centralised repository of
    >> C code).
    >>
    >> So I thought I might ask people on clc - whether such a thing
    >> exists already?

    >
    > No it doesn't.
    >
    > C has been around for so long and is used for so many different
    > things that there are many repositories for C code. Many run
    > their own libraries and examples most of the MCU vendors, compiler
    > makers, dev kit makers, various web sites for specific things like
    > CAN or 8051.com
    >
    > The C community is far to big and diverse to centralise and many
    > would not want to do it anyway.


    Many people maintain some portion of their own code in a public
    place. You can look, evaluate the accuracy and clarity, not to
    mention usefulness, and grab what you want. In my case you want
    the download section of my page.

    --
    Merry Christmas, Happy Hanukah, Happy New Year
    Joyeux Noel, Bonne Annee.
    Chuck F (cbfalconer at maineline dot net)
    <http://cbfalconer.home.att.net>



    --
    Posted via a free Usenet account from http://www.teranews.com
    CBFalconer, Dec 21, 2007
    #14
  15. Khookie

    Richard Bos Guest

    user923005 <> wrote:

    > On Dec 21, 1:42=A0pm, Richard Heathfield <> wrote:
    > > user923005 said:
    > >
    > > > C collections are scattered all over the place. =A0You have to look for
    > > > numerical code in one place and data structures code in another, etc.

    > >
    > > Hence my suggestion for a single Well-Known Portal - so well-known that
    > > everyone would know to try it first when looking for libs.
    > >
    > > > I think that the reason CPAN and BOOST don't exist for C is that it is
    > > > almost impossible to create them. =A0We had this discussion before about=

    >
    > > > creating a generic data structures and algorithm library for C ["C
    > > > needs a BOOST"], and the general consensus was that it was too
    > > > difficult.

    > >
    > > The library is easy. It's the consensus that's difficult. Getting everyone=

    >
    > > to agree on an interface is a Sisyphean task.

    >
    > But that's just it -- writing an algorithm with a generic interface in
    > C is a difficult task.


    I'd put the emphasis differently: C is used for tasks for which writing
    a generic interface which is both useful for enough applications _and_
    efficient enough is difficult. C++ apps can often afford to spend
    microseconds deciding which container handler to use. C programs can't.

    Richard
    Richard Bos, Dec 24, 2007
    #15
  16. On Fri, 21 Dec 2007 14:43:43 -0800 (PST), user923005
    <> wrote:
    <snip>
    > Another advantage of C++ for this sort of thing is ... syntactic sugar ...
    > For instance,
    >
    > if (a < b) {/* do stuff */}
    >
    > compared to:
    >
    > if (compare(a,b) < 0) {/* do stuff */}
    >
    > hardly seems any simpler. But when you have a page full of this kind
    > of stuff, it becomes much easier to grasp in the more compact
    > notation. Now, in C++ we are going to have to write a whole MESS of
    > operator overloads to get the same functionality as a compare()
    > function:
    > operator < [ and <= and == and >= and > and != ]
    > but once you have done the work, the ease in notation makes
    > programming more natural [at least in the large.]


    <OT C++> Nit: Actually for well-behaved cases you only need to write
    operator== and operator< and <utility> fills in the others.

    This doesn't damage your point, obviously.

    - formerly david.thompson1 || achar(64) || worldnet.att.net
    David Thompson, Dec 30, 2007
    #16
    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. Jay
    Replies:
    1
    Views:
    382
    William Brogden
    Jun 6, 2004
  2. *Prot3anThr3ad*

    old repository for old C++ source code

    *Prot3anThr3ad*, Sep 29, 2006, in forum: C++
    Replies:
    6
    Views:
    372
    *Prot3anThr3ad*
    Oct 2, 2006
  3. ChrisO
    Replies:
    8
    Views:
    160
    Alan Chen
    Aug 8, 2005
  4. ChrisO
    Replies:
    1
    Views:
    113
    ChrisO
    Aug 8, 2005
  5. Code Repository

    , Feb 1, 2013, in forum: Java
    Replies:
    7
    Views:
    249
    Manuel Dahmen
    Feb 4, 2013
Loading...

Share This Page