Thread: Another esbo thread hijack trying to start a flame war

  1. #31
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by esbo View Post
    You can design and write bad code in any language, I don't really see what makes C++ so special.
    Yes, that is repeating, roughly what I started out with.

    However, my point is that the purpose of object oriented programming is the form of encapsulation and extension that the class structure provides.

    It is admittedly possible to do in C too, but it's much harder and the language doesn't "help" in this aspect. In more traditional (procedural/functional) programming, any encapsulation done has to be achieved by the programmers direct effort, there is no provision for the compiler to tell the programmer "Look, you are doing it wrong here, you should not use struct X's member variable Y" - C++ has "private" which means that a member variable is not accessible outside of the class - so you can't by mistake "forget to call the appropriate access function".

    This only matters if you are writing code that is relatively large (more than a few hundred or thousand lines of code).

    Reliability (such as keeping track of memory allocations and other resources) is made easier thanks to the form of constructor/destructor policy that classes provide. There is no need for the programmer [in general] to write a lot of code to handle this. C does not make life so easy here either.

    And of course, if you have stupid people, you will end up with stupid code. I have seen a fair number of examples of that in both C and C++ - there is no silver bullet.

    --
    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.

  2. #32
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Quote Originally Posted by esbo View Post
    To be honest with you C++ comes across to me as a lot of mumbo jumbo and waffle that I don't need to write a program. There is nothing there I need nor want.
    Even if it is "mumbo jumbo", C to C++ is not a 1:1 translation that a human should need to do.

  3. #33
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    I'm with esbo. Who needs all this new stuff anyways. Why bother driving a fancy car with all those confusing knobs & buttons when you can just rid a horse instead. Why build houses out of bricks, wood & concrete when we can just find a nice cave to live in & rub sticks together to make fire...
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  4. #34
    verbose cat
    Join Date
    Jun 2003
    Posts
    209
    Exactly! All teh sexy pplz live in caves NEway!
    abachler: "A great programmer never stops optimizing a piece of code until it consists of nothing but preprocessor directives and comments "

  5. #35
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    Does C have vector ?
    And I've seen some C code, looks bad :P looks old xP But I don't know about any specifications and stuff
    Currently research OpenGL

  6. #36
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Quote Originally Posted by cpjust View Post
    I'm with esbo. Who needs all this new stuff anyways. Why bother driving a fancy car with all those confusing knobs & buttons when you can just rid a horse instead. Why build houses out of bricks, wood & concrete when we can just find a nice cave to live in & rub sticks together to make fire...

    The days when new meant better are long gone, but we have been conditioned over the
    years into thinking new means better so people accept it blindly and trott out the namecalling caveman arguemet rather than have to justify the 'new'.

    For example the new method of 'light touch' regulation for banks has not done us any favours and new anti biotics have left us with filthy hospitals full of superbugs.

    There is plenty of appalling software written these says with 'new' C++.
    Last edited by esbo; 01-24-2009 at 06:31 PM.

  7. #37
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Quote Originally Posted by Akkernight View Post
    Does C have vector ?
    And I've seen some C code, looks bad :P looks old xP But I don't know about any specifications and stuff

    Yes I believe vector is apelt a-r-r-a-y in C, one less letter, so it is more eficient
    Also the term actually describes what it is rather than use a word which describes something totally different.
    In the old days a fire was called a fire, now it's called a spoon, thats progress for you.
    No problems with that part from a few burnt lips.
    Last edited by esbo; 01-24-2009 at 06:03 PM.

  8. #38
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by esbo View Post
    Yes I believe vector is apelt a-r-r-a-y in C, one less letter, so it is more eficient
    Also the term actually describes what it is rather than use a word which describes something totally different.
    In the old days a fire was called a fire, now it's called a spoon, thats progress for you.
    No problems with that part from a few burnt lips.
    vectors can be implemented (in part) with arrays, in much the same way that a spaceship can be implemented (in part) with heat-absorbing tiles.

  9. #39
    Registered User
    Join Date
    Apr 2006
    Posts
    2,149
    Quote Originally Posted by phantomotap View Post
    O_o

    This rules out recursive templates, mutually recursive templates, nested templates, and determinism through template expansion.

    So... yea... saying that macros are capable of everything templates can do except what they can't do isn't particularly useful.
    recursive templates, mutually recursive templates: Standard C++ only guarantees 7 levels of instanciation, so this isn't very useful anyway, without compiler extensions.

    nested templates: You can nest macros; that would be passing the result of one macro as an argument to another.

    determinism through template expansion: Can you give an example of what you mean by this?
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

  10. #40
    Registered User
    Join Date
    Apr 2006
    Posts
    2,149
    Quote Originally Posted by esbo View Post
    Yes I believe vector is apelt a-r-r-a-y in C, one less letter, so it is more eficient
    Arrays don't resize for you when you need to add one more element to the end. Static arrays dont resize at all, and dynamic arrays require you to reinvent the wheel for every type stored in them.

    Linked lists are even worse in C. In C++, you just use the std::list implementation.
    Last edited by King Mir; 01-24-2009 at 07:54 PM.
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

  11. #41
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Quote Originally Posted by Bubba View Post
    Are you really that clueless?
    It would appear that he is!!!
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  12. #42
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Anyay this discussion arose when I gave an example in C but was informed C++ was required, however C is a part of C++ is it not??

  13. #43
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Quote Originally Posted by matsp View Post
    And you are obviously not interested in writing large, maintainable and reliable software.

    --
    Mats
    Nore are Microsoft apparently
    As you and I have said before you can write large unmaintainable and unreliable software in any language. Such problems are generated by the programmers, not the language.
    Further more if you also require the code to be highly efficient you are probably going to use C. You can also use assembler, but C is not that far off assember anyway.

  14. #44
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    OK, if you want an example of how C++ can kick C's butt, here you go:
    Which is faster, C's qsort() function or C++'s std::sort() function?
    Since std::sort() is a template which can take advantage of inlining, the speed can be substantially faster than qsort().
    http://www.tilander.org/aurora/2007/...and-qsort.html
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  15. #45
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by esbo View Post
    Anyay this discussion arose when I gave an example in C but was informed C++ was required, however C is a part of C++ is it not??
    No..

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple thread object model (my first post)
    By Codeplug in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2004, 11:34 PM
  2. Replies: 2
    Last Post: 04-12-2004, 01:37 AM
  3. Closing thread handles from within
    By Sang-drax in forum Windows Programming
    Replies: 6
    Last Post: 09-26-2003, 12:18 PM
  4. How to make a thread sleep or std::recv timeout?
    By BrianK in forum Linux Programming
    Replies: 3
    Last Post: 02-26-2003, 10:27 PM
  5. Multi-Thread Programming
    By drdroid in forum C++ Programming
    Replies: 6
    Last Post: 04-04-2002, 02:53 PM