Add safeness

Discuss new features and future development.
Post Reply
zaerl
Posts: 40
Joined: Fri Aug 28, 2009 8:36 am
Contact:

Add safeness

Post by zaerl »

Hi there

I'm using your (fabulous) library in a small project on the iPhone (no cocos-2d powered). The code is very well written and I really enjoy the results you can achieve. So thanks for the good job.

I suggest to add some degree of safeness on the next releases. A good start, in my opinion, is to add some protection against SEGFAULT. For example in function cpBodySetMass:

Code: Select all

void
cpBodySetMass(cpBody *body, cpFloat mass)
{
	// a simple check
	if(!body) return;

	body->m = mass;
	body->m_inv = 1.0f/mass;
}
in order to avoid the simplest errors.

Anyway keep up the good job.

P.S. I can help if you want. I am an experienced C programmer.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Add safeness

Post by slembcke »

Makes sense. Though I would probably use an assertion as it's more helpful to get an immediate error than trying to figure out why something isn't working even when it's getting called. (shakes fist at Obj-C and it's behaviour of ignoring messages to nil)
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
Tam Toucan
Posts: 141
Joined: Tue Jun 23, 2009 4:26 pm
Contact:

Re: Add safeness

Post by Tam Toucan »

I'd rather see asserts used for this. Like you say I want to know if I've got a null and I don't want redundant checks in the library. Ok the above isn't going to be called much, but you never know.

Just being pedantic, but you would have to check for mass equals zero as well....for me stuff like this is low priority
zaerl
Posts: 40
Joined: Fri Aug 28, 2009 8:36 am
Contact:

Re: Add safeness

Post by zaerl »

Well yes it's low priority but it will be a good add. SEGFAULTs are quite annoying.

Have a nice day (I'm shaking my fist against ObjC policies.)
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests