by pat » Mon Aug 30, 2010 7:05 am
yea i figured optimization could be a reason for it, though i'm not sure that it would make a difference since its pointers, with the cpBodyL2W/W2L functions those cpv calls take const cpVect's (which i wouldnt think would matter in the long run since its still doing a copy).
Like i'm working on a world editor and stuff like plotting shapes i ushaully keep the body constant incase the project gets more of a team and people think they should be playing with other stuff besides whats not constant (which is really th only reason for const i'd say).
The other times when i'll use const is so that the person writing code with my code knows that that value that there sending is not going to be modified, Which i think would be a good thing in chipmunk to do for people who are new to game programming and don't know what is actually gonna be modifying stuff and not. Its pretty standard to do this with c++, i'd imagine the same with c but i don't really have the background to say that.