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; I know a will be equal to be then No1 - In C you know that this 2 objects will ...

  1. #121
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    I know a will be equal to be then
    No1 - In C you know that this 2 objects will be equal
    in C++ you need to read the code of the Copy constructor or operator = to know what is going on

    And just looking on the code - you do not know if you need to read the additional code or not.

    In C - when you see
    MycopyStruct(&a,&b);

    you know exactly what function is called and why.
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  2. #122
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    Quote Originally Posted by vart View Post
    You are ready to do 2 jobs for price of one? Why to leave?
    The assumption is that it won't be an everyday thing. The transition period is usually about 1 month before you leave, and up to 2 months after you leave, and the severance package should reflect this. No severance package, then of course no support, but then its not what I would call 'amicable'.
    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.

  3. #123
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    Quote Originally Posted by abachler View Post
    The assumption is that it won't be an everyday thing. The transition period is usually about 1 month before you leave, and up to 2 months after you leave, and the severance package should reflect this. No severance package, then of course no support, but then its not what I would call 'amicable'.
    That what I said - when found a bug in a code that was written a year, or two, or 5 years ago - you on your own. You will take a code and have to figure out by yourself what the person that wrote the code has thinking while writing it.
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  4. #124
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,007
    Quote Originally Posted by vart View Post
    No1 - In C you know that this 2 objects will be equal
    But is it correct? If you need a deep copy?

    in C++ you need to read the code of the Copy constructor or operator = to know what is going on
    Sure, but if the copy constructor does something else than the necessary work for copying the object, then the copy constructor is flawed and you have a bug in your code. I should note that I should be able to know that when I see a = b, regardless of how the class is implemented, a SHOULD be equal to b afterwards.

    And just looking on the code - you do not know if you need to read the additional code or not.

    In C - when you see
    MycopyStruct(&a,&b);

    you know exactly what function is called and why.
    In that case, the C++ code is no more difficult than the C code.

    But how are you going around polymorphism in C? I don't know, but I do believe it will look messier in C than it would C++.
    Perhaps you might argue it's harder to understand WTF is going on, but the code is cleaner, nicer and you just need to understand what the objects does.
    This is what I believe anyway.
    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. #125
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    But is it correct? If you need a deep copy?
    Logical correctness is independent of the programming language. Whether you need a deep copy or not has nothing to do with how a deep copy is done.
    The point is that in C, if a deep copy is done, it is done very explicitly. In C++, you have to look up the constructor - either the code or the documentation - to find out whether it does deep or shallow copying.

    Actually, since most objects have a "sensible" copying mode, that makes it actually easier for casual reading. But I'm talking about auditing, about tracing exactly what the code does and whether it conforms to specific criteria (security, execution time, ...).
    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

  6. #126
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,007
    Yes, well, then again... if all objects handle themselves, then you don't really need to know their specifics - just use their implemented interface! That is typically how classes should work. So that can take away some time.
    But if you need to trace every single line, sure, it will probably take longer 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.

  7. #127
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    Quote Originally Posted by vart View Post
    That what I said - when found a bug in a code that was written a year, or two, or 5 years ago - you on your own. You will take a code and have to figure out by yourself what the person that wrote the code has thinking while writing it.
    Personally I would refuse unless it was a fairly straight forward piece of code. Ive done this before. I usually just tell my boss, 'hey, its spaghetti code, it will be faster to write a new function from scratch'. I only guarantee tht my code will compile and run, eventually. i dont guarantee that it can be maintained by anyone but myself. In fact, I dont even guarantee that. My boss gave me a new feature to add to a program I havent worked on in 2 months, adn its to a part of the program I havent messed with in 6 months. Its going to take me a day and a half just to refamiliarize myself with the program, and I WROTE IT. The cold hard fact is that the more complex the project, the less likely the code will be eternally maintainable. This is doubly true if the initial project isnt managed properly.
    Last edited by abachler; 01-15-2008 at 02:52 PM.
    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.

  8. #128
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    i dont guarantee that it can be maintained by anyone but myself. In fact, I dont even guarantee that.
    And that's why I wouldn't hire you.
    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

  9. #129
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    Quote Originally Posted by CornedBee View Post
    And that's why I wouldn't hire you.
    I doubt very much you work on projects that would require my skills or that would even interest me, no offense. Most of my code is so highly optimized that even I find it difficult to read after a few months. A subroutine that can process a 30 fps MJPEG stream on less than 2% cpu tends to not be very readable.
    Last edited by abachler; 01-15-2008 at 04:22 PM.
    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.

  10. #130
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    I very much doubt I'm in a position to even hire anyone.

    But still, your attitude is something I cannot understand.
    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

  11. #131
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    Fully portable code is nice, easy to maintain code is nice, but the reality is that no company has infinite time or resources to devote to writing perfect code. This will impact the maintainability of the code. Over time new techniques will arise that are incompatible with the existing schema. No matter how large an investment in an application there will come a time when it has had so many fingers in the pie, is so outdated, that it will no longer be feasable or cost effective to continue to maintain it. Im sorry but I really have better things to do than to memorize every line of code in every application I work on. As I said, after about 2 months of not working on the code, I have trouble following the code even I wrote. not that its unreadable code, just that the procedures are no longer familiar to me. At any given time I am working on 3 to 4 projects. I cant always remember everything or every technique I used in something that I finished 5 or 6 projects ago. Now imagine someone else trying to read code that was written 10 years ago. Not only is the coding style unfamiliar, but it has also been amintained by multiple other people who are probably also no longer there and used techniques that are unfamiliar to the programmer. Ultimately its a disaster waiting to happen.
    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.

  12. #132
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    that's what comments are for.

  13. #133
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    And documentation. Which is why we use them -- right?

    @abachler: So are you saying that we shouldn't even bother trying to write good code because all software projects are doomed in the end? Seems a bit fatalistic and pessimistic to me.
    Last edited by dwks; 01-15-2008 at 05:08 PM.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  14. #134
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,761
    > I doubt very much you work on projects that would require my skills or that would even interest me, no offense.

    What in the world do you do for a living? Really. Perhaps an answer would give us some insight as to why your projects are so difficult and why you're so keen on judging yourself ahead of the rest of the labor. You're arrogant enough to assume that what you, specifically, have to do everyday is the direction the entire industry needs to take, I think. It's just very confusing.

  15. #135
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    He's working on the killler robot. The MJEPeg screen needs to work optimally to kill innocents.

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, 02:39 AM
  2. Replies: 2
    Last Post: 09-28-2006, 02:06 PM
  3. C++ tests.
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 38
    Last Post: 06-30-2006, 07:51 AM
  4. Confuted/Blackrat: quaternion question
    By Silvercord in forum Game Programming
    Replies: 12
    Last Post: 08-18-2003, 07:02 PM

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