Thread: Weird behaviour in overloading operator+ (Xcode vs .Net)

  1. #16
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Quote Originally Posted by cpjust View Post
    Code:
    Point& Point::operator =(Point &p)
    should be:
    Code:
    Point& Point::operator =(const Point &p)
    because you aren't (and shouldn't be) modifying p.
    After that, it compiles fine in Comeau C++ compiler.
    And that will then be the 5th time the OP has been told (one way or another) that it needs to take a const reference.
    I have no idea? Maybe one of them has a bug, or maybe one has an extension to try to make it more helpful?
    The problem is that .NET does NOT have C++ as one of its languages. It has this thing called C++/CLI that is based on C++, but it isn't the same as C++, and you ran into one of the silly little differences. It should probably be const in both cases.
    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"

  2. #17
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by iMalc View Post
    The problem is that .NET does NOT have C++ as one of its languages. It has this thing called C++/CLI that is based on C++, but it isn't the same as C++, and you ran into one of the silly little differences. It should probably be const in both cases.
    When he says .NET, I'm assuming he's referring to Visual Studio .NET (2001 - 2008?).
    When you create a new project in VC++ you have options for CLR, Win32 and General.
    I've never used CLR, but I hear it works great for cleaning dirty coffee pots.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. StretchDIBits() - weird behaviour..
    By lobo in forum Windows Programming
    Replies: 13
    Last Post: 10-04-2010, 11:23 PM
  2. VC++ 2005 Express: Weird Behaviour
    By psychopath in forum Tech Board
    Replies: 2
    Last Post: 06-21-2006, 07:47 PM
  3. Weird problem with overloading
    By Strait in forum C++ Programming
    Replies: 9
    Last Post: 02-19-2005, 07:34 AM
  4. .net
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 02-15-2002, 01:15 AM
  5. Visual J#
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 10-08-2001, 02:41 PM