Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualjohnmarinelli

Posted 05 February 2013 - 05:36 PM

Hi guys,

 

I was recently told that my code is missing the Rule Of Three concept, and that my timer isn't const-correct.

 

I know of these terms; but google and searching the forums didn't help much.

 

I think what would help, however, would be an example of each concept (Rule of Three, Const-correctness) related to Game Programming.  I know what the Rule Of Three is for (creating copy ctor, assignment ctor, and dtor), but I don't completely understand why.  Also, I know that RAII/smart pointers take care of all that altogether, but I'd like to understand the Rule of Three.

 

As far as const-correctness, I think that it means that when you pass a variable by reference to a function, you should pass it as a const so that you're assuring it doesn't get changed.  does this mean that in my game loop, the Update(int &deltaTicks) function should be Update( const int &deltaTicks )?


#2johnmarinelli

Posted 05 February 2013 - 03:37 PM

Hi guys,

 

I was recently told that my code is missing the Rule Of Three concept, and that my timer isn't const-correct.

 

I know of these terms; but google and searching the forums didn't help much.

 

I think what would help, however, would be an example of each concept (Rule of Three, Const-correctness) related to Game Programming.  I know what the Rule Of Three is for (creating copy ctor, assignment ctor, and dtor), but I don't completely understand why.  Also, I know that RAII/smart pointers take care of all that altogether, but I'd like to understand the Rule of Three.

 

As far as const-correctness, I think that it means that when you pass a variable by reference to a function, you should pass it as a const so that you're assuring it doesn't get changed.  does this mean that in my game loop, the Update(int deltaTicks) function should be Update( const int deltaTicks )?


#1johnmarinelli

Posted 05 February 2013 - 03:37 PM

Hi guys,

 

I was recently told that my code is missing the Rule Of Three concept, and that my timer isn't const-correct.

 

I know of these terms; but google and searching the site didn't help much.

 

I think what would help, however, would be an example of each concept (Rule of Three, Const-correctness) related to Game Programming.  I know what the Rule Of Three is for (creating copy ctor, assignment ctor, and dtor), but I don't completely understand why.  Also, I know that RAII/smart pointers take care of all that altogether, but I'd like to understand the Rule of Three.

 

As far as const-correctness, I think that it means that when you pass a variable by reference to a function, you should pass it as a const so that you're assuring it doesn't get changed.  does this mean that in my game loop, the Update(int deltaTicks) function should be Update( const int deltaTicks )?


PARTNERS