Thread: Overloaded assignment

  1. #16
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    This is debatable argument, and there are people of both sides, but Bjarne, the creator of C++ thinks that this is the wrong approach, and as do I and others on this forum. You should not have to learn how to do C stuff in C++ unless you absolutely must, and as a beginner, that is not something you must. IMO, you should concentrate on writing good, safe and flexible C++ programs until you get experienced enough to delve into deeper stuff.
    Learn to harness C++ features and STL, and don't use low-level stuff such as new, delete and char* unless you absolutely must.
    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.

  2. #17
    Tears of the stars thames's Avatar
    Join Date
    Oct 2012
    Location
    Rio, Brazil
    Posts
    193
    Now you don't need new, delete, assignment operators, copy constructors, destructors and all that stuf
    do you mean, almost never ?
    c'mon, why do they write books like that then? I read the ACCU review from your link. It was very disappointing because everything that is written is true.
    Last edited by thames; 12-29-2012 at 09:08 AM.

  3. #18
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Quote Originally Posted by thames View Post
    do you mean, almost never ?
    c'mon, why do they write books like that then?
    It's part of the game of school. They show you the hard way to do a math problem, then they go "Now here's the easy way" and the class chucks their calculators at the teacher. It's kinda the same way with programming, for some reason, for most books.

    It's partly C++'s fault too, for supporting duplicate features. The whole reason C can compile as C++ was in order to popularize C++. C++ itself is pretty old (albeit alive).

  4. #19
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by thames View Post
    do you mean, almost never ?
    c'mon, why do they write books like that then? I read the ACCU review from your link. It was very disappointing because everything that is written is true.
    There are some who believe in bottom-up approaches (start from hardware, then go up). There are some who just don't know C++ good enough (some are mostly C programmers). Some have been taught C++ incorrectly (for example, reading a bottom-up book or simply one that doesn't teach STL). Some are ones that have been taught an older version of C++ and haven't bothered to keep themselves up-to-date. And so on.
    The world isn't perfect.
    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. #20
    Tears of the stars thames's Avatar
    Join Date
    Oct 2012
    Location
    Rio, Brazil
    Posts
    193
    Thank you for saving me Elysia! I'm starting C++ Primer 5th edition

  6. #21
    Bored Programmer
    Join Date
    Jul 2009
    Location
    Tomball, TX
    Posts
    428
    Don't want to hijack a thread but Elysia your link went to a review that said.

    "This book puts the using namespace std globally in headers which should NEVER be done."

    This concerned me as I have done so in the past. In a case such as needing to declare vectors in the class declaration. As with all beginners I only did this because I did not know better and had never run into any issues with this (probably because I didn't use any other namespaces in my program). Where would be the appropriate place to put the using namespace? Would it be within the class itself?
    Virtual reality hello world http://www.rodneybrothers.com/vr/vrh...rld/index.html in html and javascript.
    Viewable with dodocase, google cardboard, OR, and other compatible VR gear.

  7. #22
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    The best thing to do with namespaces in header files in particular is to eschew using namespace directives entirely and write std::vector<Foo> and the like instead. You could also use the pimpl idiom to get around it, since the declaration of the class is essentially in a source file.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. About overloaded constructor
    By student111 in forum C++ Programming
    Replies: 9
    Last Post: 06-14-2012, 10:29 AM
  2. Replies: 3
    Last Post: 04-26-2009, 08:54 AM
  3. About Overloaded Operator. Please Help
    By Antigloss in forum C++ Programming
    Replies: 2
    Last Post: 08-05-2005, 07:48 AM
  4. Overloaded >>
    By alphaoide in forum C++ Programming
    Replies: 2
    Last Post: 04-17-2004, 12:27 AM
  5. overloaded <<
    By alphaoide in forum C++ Programming
    Replies: 9
    Last Post: 03-15-2004, 08:29 PM

Tags for this Thread