Results 1 to 10 of 10

Thread: C

  1. #1
    Join Date
    Aug 2011
    Beans
    56

    C

    why do most open source linux programs seem to use ISO C over other languages(including C++), even for seemingly trivial programs that can be written in much easier languages. You don't really need the low level of C for many of these programs.

    Any particular reason for this or is it just a common preference in the gnu/linux community?

  2. #2
    Join Date
    Sep 2009
    Beans
    217

    Re: C

    Here's just a casual run down of possible reasons:
    • C is guaranteed to be available.
    • C has libraries for just about everything.
    • The underlying implementation of a great many things is in C, so using C gives you easy access to them.
    • C is generally easy to interface with from other languages, so many libraries get written for it (see the second point.)
    • C's fast.
    • C's not too complicated.
    • It doesn't matter what language you pick if the problem is trivial.
    • C's a popular language (perhaps the most popular.) Means that there's more potential for external aid.

  3. #3

    Re: C

    I don't like the implication that there's something wrong with C or that one needs to justify one's decision to use it for one's own project, so I'll turn the question back on you: Why should you use any other language (especially C++) when C is available?

    Edit: Just to say I'm not suggesting C is the best language or should be a default choice, I just want to highlight the preposterousness of the question.
    Last edited by trent.josephsen; October 6th, 2012 at 02:27 PM.

  4. #4
    Join Date
    Apr 2009
    Location
    Germany
    Beans
    2,134
    Distro
    Ubuntu Development Release

    Re: C

    Quote Originally Posted by trent.josephsen View Post
    I don't like the implication that there's something wrong with C or that one needs to justify one's decision to use it for one's own project, so I'll turn the question back on you: Why should you use any other language (especially C++) when C is available?
    if you write something communicates with the outside world you should be able to justify why you chose C.
    It is very hard to write secure code with C.
    Of course its also hard with other languages but with C it is easier to make mistakes.

  5. #5
    Join Date
    Nov 2005
    Location
    Bordeaux, France
    Beans
    11,294
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: C

    Quote Originally Posted by MadCow108 View Post
    It is very hard to write secure code with C.
    No, it is very easy. You just have to know what you are doing. Just becaus a lot of people who use C are not competent to use it is not an argument against C.

    EDIT: Besides, writing secure code in Java or Python is a lot more difficult because keeping track of what exactly happens to your data through all the levels of abstraction requires very deep knowledge of the language, not just programming competency. In C, nothing is hidden.
    Last edited by Bachstelze; October 6th, 2012 at 03:17 PM.
    「明後日の夕方には帰ってるからね。」


  6. #6
    Join Date
    Jan 2007
    Location
    Location: Location:
    Beans
    1,246
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: C

    Idk about C being more or less secure, and so far as how 'hard/difficult/easytomakemistakes' it is, I'd call that the coders level of experience with C, what's already learned is not easy or hard and greatly depends on your understanding, memory and wpm.

    http://www.ioccc.org

    A few award-winning examples of how naughty you can be with obfuscation and C..
    I'm trying to figure this one out still.. lol

    http://www.ioccc.org/2011/akari/akari.c <-- Can anyone tell what the obfusc is?

    http://www.ioccc.org/2011/akari/hint.html
    Last edited by |{urse; October 6th, 2012 at 04:02 PM.
    clear && echo paste url and press enter; read paste; (youtube-dl $paste) | zenity --progress --title="" --text "Downloading, please wait" --auto-close --pulsate && ans=$(zenity --file-selection); gnome-terminal -x mplayer "$ans"

  7. #7

    Re: C

    Okay, maybe asking a stupid question wasn't the best way to convey the point I wanted to get across...

    There's this notion, which seems to be pretty popular among inexperienced programmers, that C has been somehow obsoleted by higher level languages. In high school I bought a copy of K&R2 and all my programming friends acted like I must be dumb, like I'd decided to learn QuickBASIC, or Coptic, or COBOL. Many people seem to think C++ is the "next version" of C -- an understandable mistake, I guess -- and therefore new development should use the new language instead of the old. There's a tendency to forget that development is continuous on all abstraction levels, from Verilog to Prolog, and the invention of new tools for growing application domains does not render the old tools redundant.

    </soapbox>

  8. #8
    Join Date
    Aug 2006
    Location
    60°27'48"N 24°48'18"E
    Beans
    3,458

    Re: C

    Quote Originally Posted by Bachstelze View Post
    EDIT: Besides, writing secure code in Java or Python is a lot more difficult because keeping track of what exactly happens to your data through all the levels of abstraction requires very deep knowledge of the language, not just programming competency. In C, nothing is hidden.
    Well, that part is more the responsibility for the language sandbox itself being secure from the start. There is little you can do if the platform is insecure, and IMO it really is not a real solution to know all the possible glitches it may have and to adapt to them.
    LambdaGrok. | #ubuntu-programming on FreeNode

  9. #9
    Join Date
    Aug 2011
    Location
    47°9′S 126°43W
    Beans
    2,160
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: C

    Quote Originally Posted by tehcavil View Post
    why do most open source linux programs seem to use ISO C over other languages(including C++), even for seemingly trivial programs that can be written in much easier languages. You don't really need the low level of C for many of these programs.

    Any particular reason for this or is it just a common preference in the gnu/linux community?
    The whole KDE environment is written in C++...

  10. #10
    Join Date
    Aug 2011
    Beans
    56

    Re: C

    Hey I didn't mean to put down C I was just wondering why so many seemed to prefer it. thanks for all your answers.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •