View Poll Results: Do you want a Code Snippets forum or sub-forums

Voters
17. You may not vote on this poll
  • Yes, a Code Snippets forum or sub-forums seems as a good idea

    9 52.94%
  • No, this is a waste of time

    7 41.18%
  • dunno, dun care

    1 5.88%

Thread: Code Snippets?

  1. #1
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717

    Post Code Snippets?

    So, I had an idea which some might think stupid, but I think it's decent
    The thing is, why don't we have a Code Snippets forum? Maybe sub-forums under C++ and C forums and C# is that's needed... These forums would only be there to post finished snippets of yours, simple or advanced, doesn't matter, also this way you can search the Code Snippets forum for some snippet you'd like and maybe it exists, like algorithms and stuff...
    Do you think this is a good idea, or just rubbish?
    Last edited by Akkernight; 07-08-2009 at 06:08 PM. Reason: Topic Title change
    Currently research OpenGL

  2. #2
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    sure, the atmosphere of the current c/c++ boards is "ZOMG it's not working, fix it for me", I guess it'd be nice to have an atmosphere of "time to ZOMG optimize" (If that's what you're thinking)
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  3. #3
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  4. #4
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    Quote Originally Posted by Dave_Sinkula View Post
    except with talking
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  5. #5
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    As long as we can classify the snippets by school, course, and assignment number
    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
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    >> sure, the atmosphere of the current c/c++ boards is "ZOMG it's not working, fix it for me", I guess it'd be nice to have an atmosphere of "time to ZOMG optimize" (If that's what you're thinking)

    Heh, true.

    >> As long as we can classify the snippets by school, course, and assignment number

    Right?
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  7. #7
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    Cprogramming.com - C/C++ Programming Code Snippets isn't on cboard, I barely use cprogramming.com :S Also, you can't post replies on Cprogramming.com - C/C++ Programming Code Snippets, like the idea is not for code snippet questions, that's what the current forum is for, but still people should be able to ask what it does, if more description should be added, if there's a better way to do it, bla bla bla, well that was my idea anyways..
    Also, if it's on cboard, it gets WAY much more attention as I guess more people surf cboard than cprogramming :S
    Also, my idea was to upload header files, as in Code Snippets should ALWAYS be header files, makes them easy to implement, but if they are too long, then some .c/.cpp files could also be used, but to make it easy for other people, just using one header would be best
    Last edited by Akkernight; 07-08-2009 at 07:41 PM.
    Currently research OpenGL

  8. #8
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Damn me if the C++ and C boards aren't exactly meant for that.

    Note: I don't vote on polls. Unless my name is somewhere in there.
    Last edited by Mario F.; 07-08-2009 at 08:50 PM. Reason: don't wanna talk about it
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  9. #9
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    Quote Originally Posted by Mario F. View Post
    pools.
    I lol'd
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  10. #10
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    ugh!
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  11. #11
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by Akkernight View Post
    [url=http://www.cprogramming.com/snippets/]
    Also, my idea was to upload header files, as in Code Snippets should ALWAYS be header files,
    Unless we're talking templates, then I can summarize all the code snippets we'll get right here that work as headers:
    Code:
    
    

  12. #12
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    well, I meant uploaded files, but I guess this idea wasn't so good xP
    Currently research OpenGL

  13. #13
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Don't hide the poll voters, I like to judge people

  14. #14
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    I've seen this done on another board. The quality average is low, and it would tie up a lot of resources to point out all the mistakes.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  15. #15
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by CornedBee View Post
    I've seen this done on another board. The quality average is low, and it would tie up a lot of resources to point out all the mistakes.
    Hmmm...but isn't that the point of the board? People helping other people with programming? Most of it already is people posting code and asking someone to help fix the mistakes or improve something, etc, often the same exact things over and over again. My idea would be to post working examples of things that people commonly try, sort of like a very short winded tutorial that is just code with comments -- since there are already lots of tutorials around, but the norm there is usually *not* to provide much in the way of demo code.

    The same is true of actual documentation such as man pages, where it is basically standard to write several pages of explanation without a single example of the actual syntax; when learning a new API I usually have to deduce the syntax from the "explanation" and perform a few little tests before I get it right. I'm more comfortable with that now, but it seemed very counter-productive to me when first starting out, and I doubt the intention is anything so high minded as to force beginner's to make deductions, etc, which even if it is I'm not sure if I consider that so clever anyway.

    My point is you are right CornedBee, the web is short on quality snippets, but probably the gang at cboard are just the gang to provide it. Nobody is asking you to do work you don't want to do, of course.
    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. Storing Code Snippets
    By saeculum in forum Linux Programming
    Replies: 1
    Last Post: 03-15-2009, 08:47 PM
  2. Joining these code snippets
    By spadez in forum C Programming
    Replies: 4
    Last Post: 02-07-2009, 04:07 PM
  3. Values changing without reason?
    By subtled in forum C Programming
    Replies: 2
    Last Post: 04-19-2007, 10:20 AM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Couple Code Snippets
    By Unregistered in forum Game Programming
    Replies: 1
    Last Post: 01-22-2002, 02:23 AM