Thread: Is C suited for big applications?

  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    60

    Is C suited for big applications?

    Well, maybe it's a stupid question, but I don't know the answer and I hope to see one here.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    It is a question that can start flamewars, unfortunately.

    C is already in use for "big applications", although it may not be the only programming language used in such applications.
    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

  3. #3
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    There are extremely large applications written in C. Whether C is "suited" for this is up for debate. I used to manage development of a pure C application that weighed in at over a million lines. I didn't realize how painful it was until I moved on to something else.

    Keep in mind that any application of that size has probably been in development for many, many years. At the time that project started, C++ didn't even exist. The code itself started out in Fortran. Compared to that, C was a step forward. Not that Fortran is a bad language, but it definitely wasn't the right choice for that particular software.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I think that depends on the definition of suited.
    Can a big application be written in C? Certainly. Will it be easy? That depends on the application I would say.
    Are there other languages that could make the task easier? Most likely.
    Are the other languages better than C on these tasks? That depends.

    This may be a cryptic answer, but it really does depend. The best alternative is to find out each language's strengths and weaknesses and compare them to C, and compare that to the task at hand, then make a qualified guess as to whether it would be suited or not.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Registered User
    Join Date
    Dec 2008
    Location
    Black River
    Posts
    128
    Depends on what kind of "big application". If it's for something like a server, an OS kernel, a system driver, a video game, a compiler or some such then the answer is yes. There are many areas where it's probably not the best language, however (Scripting, text processing).

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I would be careful with what you say. A game can very complicated, as can a kernel and OS. The complexity may be better realized with another language. So it depends.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    Registered User
    Join Date
    Nov 2009
    Posts
    60
    I'm sorry, I don't want to start a flame war, but I'm trying to figure out if C is actually suited for my (hobby)-project, which has to do with the syntax of a natural language. It has to look up words of a given sentence in a database (sqlite), determine what kind of words these are (verbs, articles, prepositions,...) and determine the structure of a sentence:
    For example:
    The boy gave him a book.
    (subject - main verb - indirect object - direct object)

    I know that Python is well suited for natural language processing, but I don't feel comfortable with it.
    I'm not saying that Python isn't good. But it's too radically different from what I'm used to and I have difficulties learning these new paradigms.

    So, for the project given: is C suited or should I persevere and try to learn Python anyway?

  8. #8
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    It's a matter of opinion, really. Different people feel at home with different things.
    C lacks any kind of regex (string processing), so handling string literals may not be as easy as other languages. Although, regex in itself can be pretty complex.
    I cannot speak on how Python is since I've never used it, though. Perhaps others will give you some other advice, but I would say that you should try to use what you're most familiar with and what feels most natural to you.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #9
    Registered User
    Join Date
    Dec 2008
    Location
    Black River
    Posts
    128
    In that case, you can most likely stick with C. There are several libraries to handle SQL database access, although the complexity of your program appears to be in determining the structure of a sentence. Compared to Python, you'll have to write a lot more code, but since you're not comfortable with it, then you may use C.

  10. #10
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Elysia View Post
    Are there other languages that could make the task easier? Most likely.
    Are the other languages better than C on these tasks? That depends.
    If it is about easier, python will probably make it much, much, easier than either C or C++, or most other languages. I only know a little python, but presuming it is on a par with perl, functionality wise (which it seems to be, and supposedly is), I'll make you a promise in that regard. Those languages operate on a much higher level, have a tremendous core, and nothing can beat perl for library extensions (and I believe the python gang are rapidly catching up).

    "Better" is harder question to answer. Based on what you say, I don't think any one language will be that much better for this task than any other, it is really up to the programmer.

    However, if the project is serious enough that you would consider learning a new language to do it, it will probably take you several weeks to a month to learn enough to consider starting such a project in that new language. If it is very serious, I highly recommend you try to duplicate something you have already done in C first, and/or at least complete a couple of reasonably complex, fully functioning things before you move on to the big enchilada. In other words, the amount time you save coding the final product will probably be taken up learning python. Of course, you will also get something extra out of it, because you will now know python.
    Last edited by MK27; 12-22-2009 at 01:29 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

  11. #11
    Registered User
    Join Date
    Nov 2009
    Posts
    60
    Thank you very much for your opinions! I'll stick with C. and if I'm stuck, I know a good place to ask for some help.

  12. #12
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Quote Originally Posted by hilarius View Post
    Well, maybe it's a stupid question, but I don't know the answer and I hope to see one here.
    No, just 'small' projects like the Linux kernel, the microcontroller that runs your coffee maker, the electronic ignition in your car, you know, minor things like that.

    Yes, of course it is suited to large applications, although it is currently out of favor with fledgling programmers and academia.

    Quote Originally Posted by Elysia View Post
    I would be careful with what you say. A game can very complicated, as can a kernel and OS. The complexity may be better realized with another language. So it depends.
    The languages of choice for OS development are C and Assembly. In fact very few people think C++ is suited to OS development, although a few have tried it.

    Quote Originally Posted by Elysia View Post
    C lacks any kind of regex (string processing), so handling string literals may not be as easy as other languages.
    That's total bull.........
    Last edited by abachler; 12-23-2009 at 07:29 AM.

  13. #13
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by abachler View Post
    No, just 'small' projects like the Linux kernel, the microcontroller that runs your coffee maker, the electronic ignition in your car, you know, minor things like that.

    Yes, of course it is suited to large applications, although it is currently out of favor with fledgling programmers and academia.
    Clearly, this is a rather biased view!
    Is a screwdriver suitable for big construction projects? Clearly it depends, does it not?
    Why do you think C is out of favor? Because usually there is a faster and easier way to do things with another language, which kind of indicates that C may not be suited for big applications.
    Again, it depends!

    The languages of choice for OS development are C and Assembly. In fact very few people think C++ is suited to OS development, although a few have tried it.
    That is because most operating systems were started when C++ did not exist.
    Is it suitable for OS development? Just take a look at Symbian. All C++, baby!

    That's not regex. That is string handling functions. C has those, but not regex.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  14. #14
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Elysia
    That's not regex. That is string handling functions. C has those, but not regex.
    Regular expression libraries are available for C even though none of them are part of the C standard library.
    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

  15. #15
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    I generally agree in MK27 on these kind of questions. Your better choice is the language you know. It will save you much time on debugging...

    When it comes to C you can also consider C++. Is there any reason you should not use std::string? Just write C-code, use std::string and compile it as a C++ code. It will take you a few minutes to understand the syntax to use std::string w/o knowing C++ at all. You can consier C++ as an added library as well as a new language.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling C in Visual Studio 2005
    By emanresu in forum C Programming
    Replies: 3
    Last Post: 11-16-2009, 04:25 AM
  2. Get Installed applications list and applications activity
    By arunarora in forum C++ Programming
    Replies: 5
    Last Post: 05-25-2009, 09:41 AM
  3. Help it won't compile!!!!!
    By esbo in forum C Programming
    Replies: 58
    Last Post: 01-04-2009, 03:22 PM
  4. A question about windows programming
    By Hussain Hani in forum Windows Programming
    Replies: 16
    Last Post: 05-23-2007, 07:38 AM