Like Tree11Likes

Overloaded assignment

This is a discussion on Overloaded assignment within the C++ Programming forums, part of the General Programming Boards category; This is debatable argument, and there are people of both sides, but Bjarne, the creator of C++ thinks that this ...

  1. #16
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,171
    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.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

  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 08:08 AM.

  3. #18
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,526
    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).
    thames likes this.

  4. #19
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,171
    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.
    thames likes this.
    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.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

  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
    Elysia likes this.

  6. #21
    Bored Programmer
    Join Date
    Jul 2009
    Location
    Tomball, TX
    Posts
    404
    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?

  7. #22
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,526
    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.
    iMalc, Elkvis and thames like this.

Page 2 of 2 FirstFirst 12
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, 07:29 PM

Tags for this Thread


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