Add safeness

Discuss new features and future development.

Add safeness

Postby zaerl » Fri Aug 28, 2009 8:50 am

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
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.
Posts: 40
Joined: Fri Aug 28, 2009 8:36 am

Re: Add safeness

Postby slembcke » Fri Aug 28, 2009 9:25 am

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! ->
User avatar
Site Admin
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Add safeness

Postby Tam Toucan » Sat Aug 29, 2009 1:47 am

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
User avatar
Tam Toucan
Posts: 141
Joined: Tue Jun 23, 2009 4:26 pm

Re: Add safeness

Postby zaerl » Sat Aug 29, 2009 7:54 am

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.)
Posts: 40
Joined: Fri Aug 28, 2009 8:36 am

Return to Features/Development

Who is online

Users browsing this forum: No registered users and 1 guest