Why C Matters

This is a discussion on Why C Matters within the A Brief History of Cprogramming.com forums, part of the Community Boards category; 1) C done in C++ is not as fast as C done in C, the C++ compiler actually has to ...

  1. #16
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    1) C done in C++ is not as fast as C done in C, the C++ compiler actually has to translate C into C++, or else it just calls the C compiler to handle the C code.

    2) Systems level programming is done in any compiled language, Solaris is Java, windows is C++, every other os in C.
    [ yes, java has the jit, but it can be compiled into ececutables and stored that way. ]

    3) most rapid execution languages, like python, perl, php .. are actually WRITTEN in C.
    [ download the sources and check for yourself, I know PHP* and Python are both written in C. }


    * PHP's Zend engine being an exception, it is written in Java.
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

  2. #17
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Solaris's system level is C and C++, just like every other OS's.

    Zend is also written in C.

    Where do you get all these ideas?
    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

  3. #18
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >Sure, but as I mentioned to CornedBee, at least it seems to
    >follow the standard better on things such as type safety.
    C doesn't claim to be type safe. If you do something that the standard says is undefined, you should expect the result to be unpredictable. The compilers aren't to blame for bad code.

    >But then again, why use an old tool when you got a better, newer, shinier one? Shrug.
    http://www.codinghorror.com/blog/archives/000916.html

    >I know... but if we keep teaching C, it will never go away. Best to start somewhere, isn't it?
    Be my guest. If nobody knows C then I can make a killing maintaining old C code.
    My best code is written with the delete key.

  4. #19
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,594
    Be my guest. If nobody knows C then I can make a killing maintaining old C code.
    Like the COBOL programmers just before Y2K?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #20
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,538
    Quote Originally Posted by CornedBee View Post
    C1x is in the planning. The C and C++ working groups are always collaborating. When C++ gets multi-threading support, C will follow soon after. (Indeed, C interoperability concerns were the main reason thread cancellation in C++ got axed.)
    OH right, so now C is holding back C++. Sigh. Another reason to get rid of it IMO.

    Quote Originally Posted by Jaqui View Post
    1) C done in C++ is not as fast as C done in C, the C++ compiler actually has to translate C into C++, or else it just calls the C compiler to handle the C code.
    C++ code as C code is just as fast as pure C code. Several have stated that C++ can be as fast as C. You don't need to compile it as C. Compile it as C++ - it should be equally fast.

    2) Systems level programming is done in any compiled language, Solaris is Java, windows is C++, every other os in C.
    [ yes, java has the jit, but it can be compiled into ececutables and stored that way. ]
    Yes
    So why are they coded in C instead of C++, then? That's what I'm wondering.

    Quote Originally Posted by Prelude View Post
    C doesn't claim to be type safe. If you do something that the standard says is undefined, you should expect the result to be unpredictable. The compilers aren't to blame for bad code.
    Weren't the standard supposed to say it wasn't allowed? I believe someone mentioned the compilers were to blame and no the standard.

    >I know... but if we keep teaching C, it will never go away. Best to start somewhere, isn't it?
    Be my guest. If nobody knows C then I can make a killing maintaining old C code.
    There's no need to phase it out fast, just slowly
    Eventually, some languages will go down into the history and fade away, like like QBasic and things. Just let the nature run its course, so to speak. If everyone stops teaching C, it will eventually fade away with time...
    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.

  6. #21
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,485
    What there seems to be a lack of is people being taught how to program. Sure there's lots of focus on teaching programming languages, but that's only half the story. Producing a working program is a lot more effort than simply pressing the keys in the right order.

    But it seems that's all a lot of courses seem to require, because it's very easy to verify. Either you get the expected output or you don't. Assessing code quality, thoroughness of design etc etc is nowhere. If it were, perhaps we'd see less code posted here that looks like it was a dogs chew toy.

    A fair proportion of very large programs require more than one language to begin with. Again, this comes from an engineering perspective and treating languages as nothing more than tools which are specialised in solving particular kinds of problems.

    It's the car analogy I keep posting. There's way too many people rushing about who don't have a clue how to drive.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  7. #22
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,594
    The way I see it is that people do need to learn how to use the tools, even as they learn how to say, build a wall.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  8. #23
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    I think electrical engineers should primarily learn C. Computer scientists could have either language (C or Java) as their first. All other engineers should have Java as their first language.

    "Then I started teaching C++ to the electrical engineers and when the EE students started to out-program the CS students, the CS department switched to C++."

    Maybe this is because BS is an excellent teacher and not so much due to the superiority of C++ as a first language?
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  9. #24
    aoeuhtns
    Join Date
    Jul 2005
    Posts
    581
    Quote Originally Posted by DavidP View Post
    Go C/C++!
    Edit: never mind.
    Last edited by Rashakil Fol; 01-09-2008 at 12:25 AM.
    There are 10 types of people in this world, those who cringed when reading the beginning of this sentence and those who salivated to how superior they are for understanding something as simple as binary.

  10. #25
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Jaqui View Post
    1) C done in C++ is not as fast as C done in C, the C++ compiler actually has to translate C into C++, or else it just calls the C compiler to handle the C code.
    Can't avoid commenting on this one: It's complete and utter garbage. The same C code compiled by comparable C or C++ compiler will generate identical code [or sufficiently identical to not make difference performance-wise]. All C++ compilers [that I know of] have the capability of compiling plain C code as well as C++ code.
    2) Systems level programming is done in any compiled language, Solaris is Java, windows is C++, every other os in C.
    [ yes, java has the jit, but it can be compiled into ececutables and stored that way. ]
    There is very little C++ in the Windows Kernel code, maybe 5% or less - there may be lots of it in utilities and libraries [certainly in the DirectX libraries]. Solaris Kernel code is not written in Java, that's for sure, it's C and possibly C++. Again, utilities and libraries may be a different story.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  11. #26
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    The same C code compiled by comparable C or C++ compiler will generate identical code
    Not quite true, depending on the compiler's exception handling strategy.
    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

  12. #27
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by CornedBee View Post
    Not quite true, depending on the compiler's exception handling strategy.
    Can you please educate me on how that would make a (measurable) difference in a currently implemented [mainstream] compiler?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  13. #28
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    It probably wouldn't. But the code would be larger.
    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

  14. #29
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by CornedBee View Post
    It probably wouldn't. But the code would be larger.
    Yes, I agree with that, because the unwind information that needs to be stored on the stack - and that would potentially cause extra code to be executed as well - but only in lots of calls to small functions [that is, the overhead of unwind information affects the total run-time of the function]. Of course, for most such small function cases, the compiler would be able to infer that no exceptions would be thrown by the code in the function, and thus there is no reason to have any unwind info.

    --
    Mats
    Last edited by matsp; 01-09-2008 at 05:04 AM. Reason: Clarify that it's SMALL functions the compiler can determine the exceptions for
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  15. #30
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    Quote Originally Posted by Sang-drax View Post
    Maybe this is because BS is an excellent teacher and not so much due to the superiority of C++ as a first language?
    Having learned BASIC, then assembly, then C then C++ then java, I will say that I wish I had learned C++ first, even before 'C'. This is because code that is C++ compliant will also compile under C, excluding classes. Code that compiles under C may not necessarily compile as C++. Java is completely irrelevant to an EE except in so far as poor business decisions make it relevant, but its an entirely unnatural thing.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Speed of C++
    By bobthebullet990 in forum A Brief History of Cprogramming.com
    Replies: 64
    Last Post: 01-12-2007, 01:39 AM
  2. Replies: 2
    Last Post: 09-28-2006, 01:06 PM
  3. C++ tests.
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 38
    Last Post: 06-30-2006, 06:51 AM
  4. Confuted/Blackrat: quaternion question
    By Silvercord in forum Game Programming
    Replies: 12
    Last Post: 08-18-2003, 06:02 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21