View Poll Results: Boost/CPAN style resource for C: Good idea?

Voters
7. You may not vote on this poll
  • Absolutely, I can hardly wait.

    2 28.57%
  • Might be nice.

    4 57.14%
  • Silly and unnecessary.

    1 14.29%
  • Really, really hairbrained.

    0 0%

Thread: Good idea: Boost/CPAN style resource for C?

  1. #1
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300

    Good idea: Boost/CPAN style resource for C?

    This only just occurred to me, so I am not sure where I am going with it. I wanted to find out if people like the idea of a "Boost" type service for general/multi purpose C libraries.

    I have not actually made much personal use of the boost libs (being pretty new to C++), but the idea reminded me much of perl's CPAN, which is probably the biggest collection of it's kind (there are 16,000 + library modules available on CPAN, and the CPAN module itself comes standard with perl and has a apt/yum like interface to fetch/build/install any CPAN library with a few simple commands). Of course, not everything there is to everyone's tastes, but it does mean contributions are held up to a well established community for scrutiny, possible development, and distribution.

    Considering how incredible CPAN is and how apparently popular Boost is, it's amazing to me that there is not something parallel for most widely used languages.

    I'd like to see it happen for C and have time to contribute, but there is no way for me as an individual to "make it so". Hence I'm also inviting ideas about how something like that might be established. I think it would have a much better chance of success if there were first some kind of discussion with the C community at large, rather than some small group going ahead and saying, "Look what we've done! Now everyone get with the program!". I'm not a follower of any general C programming mail lists, but if anyone knows of anywhere this might be well received, please speak up. You heard of it here first
    Last edited by MK27; 05-23-2010 at 03:21 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  2. #2
    Registered User jeffcobb's Avatar
    Join Date
    Dec 2009
    Location
    Henderson, NV
    Posts
    875
    MK: first Boost as you know is C++ so I am not really seeing the overlap in C...to closest thing I can think of from an automated/organizational standpoint is is ye-old apt repositories...most times if I need a lib to do something I just apt-cache search <purpose> | grep lib and generally I find something useful. If this fails, I grep places like snippets.org, freshmeat.org, sourceforge (in that order).

    While not as automated, something I *just* ran across so I don't know much of it but in CodeBlocks (you know that IDE you are teasing me about playing with out of curiosity?) there is a plugin that lets you search koders.com which seems to let you search by licence, language and so one for code snippets, maybe libs, I don't know.

    I agree though: something like this would be handy. It just occurred to me that (while not an exact match to your question) maybe something could be based on the way things like Sabayon and other source-based distros of Linux works; since they are all keyed on finding source for libraries (and satisfying dependencies, etc) maybe a subset of this might be a starting point...
    C/C++ Environment: GNU CC/Emacs
    Make system: CMake
    Debuggers: Valgrind/GDB

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by jeffcobb View Post
    I grep places like snippets.org, freshmeat.org, sourceforge (in that order).
    The problem with sourceforge et al in this regard is that they provide hosting for anything and everything. WRT to hosting, while CPAN and Boost both do serve as primary repositories, I don't think this is necessarily a good idea for this potential project, altho it could provide some hosting where needed.

    While not as automated, something I *just* ran across so I don't know much of it but in CodeBlocks (you know that IDE you are teasing me about playing with out of curiosity?) there is a plugin that lets you search koders.com
    That is a fairly good idea. However, the organization I would prefer (since it would be C specific, and exclude non-libraries -- ie, no end user applications) would be more along the lines of CPAN. So if you needed say an XML parser or a red-black tree, you could go look under the appropriate category.

    Both C++ (?) and Perl use compound namespaces, so there was already a native form of organization there. I don't think it is too hard to come up with something sufficiently inclusive tho.

    maybe something could be based on the way things like Sabayon and other source-based distros of Linux works; since they are all keyed on finding source for libraries (and satisfying dependencies, etc) maybe a subset of this might be a starting point...
    I would not want to apply any selection criteria beyond "C library" -- eg, we would not focus on a particular platform or exclude binary only, proprietary licenses (cringe).

    A major goal here would be to provide people who have written a genuinely useful, general purpose library (such as an XML parser or red-black tree implementation or some embedded oriented thing) somewhere centralized to expose it the community at large.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    I thought I heard from someone here of such an initiative that appears to be in its infancy: CCAN.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by laserlight View Post
    I thought I heard from someone here of such an initiative that appears to be in its infancy: CCAN.
    Eureka laserlight, I was in part hoping to shake the tree here a bit. Thanks!
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  6. #6
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Quote Originally Posted by MK27 View Post
    Eureka laserlight, I was in part hoping to shake the tree here a bit. Thanks!
    If you want to make something like that, I think you'd better start from scratch then using such a project. It would be more from yourself and you'd be able to code more than that in a few hours.
    For instance, the BUILD_ASSERT sucks... And I wouldn't make a class/function called "ogg_to_pcm". I mean; if you want a function from everything to everything, it's going to be a HELL to use them all. Imagine you have to write a program to convert 10 types to 10 other types. You'd have to implement 100 functions rather than 20.
    Well, I think. I'm not sure what pcm is, but I don't think it's an intermediate type to convert audio to, like raw wave-file data. But it may be.

  7. #7
    Registered User
    Join Date
    Jan 2009
    Posts
    1,485
    Quote Originally Posted by EVOEx View Post
    I'm not sure what pcm is, but I don't think it's an intermediate type to convert audio to, like raw wave-file data. But it may be.
    PCM is the data format of a wave file, ie a wave file minus the header. Interesting idea here btw, kind of surprising that it doesn't exist, considering the age and spread of C.

  8. #8
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Quote Originally Posted by laserlight View Post
    I thought I heard from someone here of such an initiative that appears to be in its infancy: CCAN.
    Shame there is no conformance requirements. A lot of the code on there appears to be C99 and GPL.

  9. #9
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by zacs7 View Post
    Shame there is no conformance requirements. A lot of the code on there appears to be C99 and GPL.
    It says "'GPLv2 or later' and supersets thereof (eg. LGPLv2+ or BSD) licenses preferred", which I guess means they should accept unrestricted licenses. Because of the "source based" nature of the site I would presume it does have to be an open source. Maybe that is a good idea...

    Quote Originally Posted by EVOEx View Post
    Well, I think. I'm not sure what pcm is, but I don't think it's an intermediate type to convert audio to, like raw wave-file data. But it may be.
    PCM is "raw" audio data. In fact it's sometimes referred to that way: if you take an audio tool like audacity, you can load "raw" (uncompressed, headerless pcm data) soundfiles (just you must then set the sample rate, number of channels, etc, manually, because there is no header containing information).

    Anyway, I don't think there should be a restriction on the purpose of the code, just on it's quality (eg, no obviously uncorrected bugs). I don't see any bug tracking at CCAN, which seems like a serious oversight. I presume they don't need a formal system for this yet due to the small size of the archive.
    Last edited by MK27; 05-25-2010 at 08:08 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  10. #10
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Quote Originally Posted by MK27 View Post
    PCM is "raw" audio data. In fact it's sometimes referred to that way: if you take an audio tool like audacity, you can load "raw" (uncompressed, headerless pcm data) soundfiles (just you must then set the sample rate, number of channels, etc, manually, because there is no header containing information).

    Yeah, I knew the term raw, and even handled it quite a lot. That's what I always call it. Never PCM ;-). But okay, sounds fair enough. And at least the to pcm decoding then makes sense. But I still consider the site fairly basic and not really... impressive, to say the least.

    We need something with a complete open license like boost. But with a lot more functions than boost. I imagine wrappers around every possible thing you want to do: file formats, networking protocols, encryption algorithms, interface methods. Similar to JAVA's built-in crap.

    I've thought about it before. But it should really be done.

  11. #11
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by EVOEx View Post
    I've thought about it before. But it should really be done.
    I guess it is really a matter of contributing code. If CCAN works like CPAN, because everything is open source, people will come along and suggest things to you if they see room for improvement. The modules all have maintainers, and if that person has disappeared or lost interest, someone else is free to come along and pick up the responsibility. My understanding is that Boost works the same way, but boost is more dedicated to "one problem, one best solution" (??); some of the boost code gets added into the C++ standard.

    With CPAN, there are often several libraries that serve the exact same purpose, but the structure of the API will usually be different. Also, there is no real purpose to "adding" them into perl by default or something. I think that's true with C as well, where keeping the standard minimal would be most people's preference.

    Also, the lack of OO means a potentially more heterogenous approach to API structure (some perl mods do not use an OO interface, in which case there is usually an alternate one that does, or wraps the first one). Eg, I've been playing around with embedded structs instead of void pointers lately:

    Code:
    struct node {
           void *data;
           struct node *next;
    }
    If this were part of a simple linked list API, you now have to go node->data->member, having constructed your own struct for the data. If you just put the node pointers into your own struct, no library is possible.

    Instead:
    Code:
    struct mystruct {
          [members]
          struct node link;
    }
    You save a level of indirection, but "node" cannot be a pointer, because you need to use offsetof(). That means the "delete" function in the API is incomplete, and there the user must do a little more setting things up. I kind of like this approach to genericism tho.

    I guess the name CCAN is taken Is "Boost" an acronym?
    Last edited by MK27; 05-25-2010 at 09:43 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Is my career idea good?
    By face_master in forum A Brief History of Cprogramming.com
    Replies: 26
    Last Post: 08-06-2002, 01:01 PM
  2. Good idea, bad idea.
    By sean in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 06-15-2002, 12:26 PM
  3. any good resource site
    By kas2002 in forum C++ Programming
    Replies: 1
    Last Post: 06-04-2002, 05:38 PM
  4. Is this good style?
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 01-19-2002, 07:51 PM