Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c++.moderated    |    Moderated discussion of C++ superhackery    |    33,346 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 32,838 of 33,346    |
|    Seungbeom Kim to All    |
|    Re: iostream replacement    |
|    28 Jan 13 23:33:04    |
      From: musiphil@bawi.org              On 2013-01-28 13:10, fmatthew5876 wrote:       >       > When I think of operators I think of their meaning for primitive       > types. I use C as my model first and general math notation       > second. Sticking with the C meaning removes all possible       > ambiguity. If I'm overloading an operator and its not entirely       > obvious how my new type extrapolates a primitive type, I don't do       > it.              Though C can be roughly thought of as a subset of C++, there are       things from C that you have to unlearn to be better at C++, and no       different is the notion that << and >> are only bit-shift operators, I       believe.              > I also believe leveraging operator overloading for streams gives a       > bad example for new programmers. Their first hello world program       > shows them how they can use operator overloading to invent all kinds       > of new meanings for operators.              New programmers probably learn << and >> first as stream operators,       and they don't even know the operators are overloaded. So no harm       done.              Things would not be very different even if they learned << and >> as       "primitive" stream operators, and then later told that they were       "overloaded" as bit-shift operators for integers on both sides.              --       Seungbeom Kim                      [ See http://www.gotw.ca/resources/clcm.htm for info about ]        [ comp.lang.c++.moderated. First time posters: Do this! ]              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca