Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 05 Mar 2004
Offline Last Active Yesterday, 11:47 PM

Posts I've Made

In Topic: Using C++

Yesterday, 11:50 PM

So I have recently watched several videos on C++. I understand the basics, but how can I apply this into developing a game? 



Let me help put that into perspective for you...


You've just watched several videos on how to use a hammer, and now want to build your own home.

In Topic: C++ std::move() vs std::memcpy()

Yesterday, 10:52 PM

The obvious example that comes to mind, is when the object contains a pointer to one of its other members. I have just been using production code that has exactly that.


The other thing you should not overlook is that memcpy-ing may do most of the job for some types, but it doesn't in itself suppress destruction of the object where the data came from, which you would need to also do to avoid double-deletion. std::move on the other hand, gets implemented to null out pointers from the source location as necessary, causing subsequent destruction to be safe.

In Topic: References or Pointers. Which syntax do you prefer?

Yesterday, 10:46 PM

You should use references over pointers wherever possible.

When you see a pointer as a method parameter, it should tell you that either it is a C import e.g. API function, or that it needs to be given the address or an array of values rather than a single value, or that NULL is an acceptable thing to pass in.

In Topic: Over ridden comparison operator returning false comparisons

18 April 2014 - 07:45 PM

The problem is not with the portion of code you have posted. The problem lies elsewhere e.g. in the getRank method or somewhere else.

Post more code.

In Topic: Binary search implementation

12 April 2014 - 03:40 AM

There are several unusual things you are doing there.

I discussed binary search and how to do it better, in this article that I wrote about various searching techniques: