Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


jnmacd

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

Posts I've Made

In Topic: reinterpret_cast problem

15 March 2013 - 11:35 AM


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.


Wouldn't that just bork all of the array instead of just the first double?


Yes, he asked why only the first got screwed up. This will screw all of them up.

In Topic: reinterpret_cast problem

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.

In Topic: Qt and setData()

07 March 2013 - 04:48 PM

thanks jnmacd, that fixed it.  I was using a few examples i found online. oh well.  you can't always trust everything on the internet!

 

are you familiar with Qt?

Yes, my main development environment.


In Topic: Qt and setData()

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.


In Topic: Iterator list corrupted (even with correct references)

21 May 2012 - 11:41 AM

You should not be storing an iterator.
Instead, search for the town inside the list, then remove the town from the list.
Then delete the town.


std::list<town*>::iterator it;
for (it=townList.begin(); it!=townList.end(); ++it)
{
	 if (*it == u)
	 {
		  townList.erase(it);
		  break;
	 }
}
delete u;

PARTNERS