Jump to content

  • Log In with Google      Sign In   
  • Create Account

jnmacd

Member Since 22 Sep 2010
Offline Last Active May 23 2013 11:25 AM

#5042778 reinterpret_cast problem

Posted by jnmacd on 13 March 2013 - 12:29 PM

Well you are pointing to the first element in the array, then modifying only sizeof(double) bytes.
Any memory after sizeof(double) bytes should be unaffected.
 
To modify all,
 
memset(ma,1,sizeof(double)*5);
This has nothing to do with reinterpret_cast.


#5039217 Qt and setData()

Posted by jnmacd on 04 March 2013 - 04:32 PM

Its hard to read your code since its not formatted...

but it looks like you are creating sceneItem as a local variable on the stack, then saving the memory address and trying to access it when sceneItem goes out of scope.

 

You can't do this.




#4859468 [C++] instantiate objects dynamically

Posted by jnmacd on 09 September 2011 - 07:00 AM

You can not have dynamic variable names in C++.
Use a container instead.
std::vector<Bullet>




#4844969 Player getting hurt problem

Posted by jnmacd on 05 August 2011 - 06:16 AM


     else
	{
		if( monsterXPos  == xPos )
		{
			health - 1;
			if( health < 0 )
				health = 0;
			xVel += 40;
			yVel -= 5;
		}
	}


You are not affecting health.


PARTNERS