robotology-legacy / codyco-modules

Whole-body Compliant Dynamical Contacts in Cognitive Humanoids
www.codyco.eu
Other
19 stars 13 forks source link

Double constify wholeBodyModel input parameters #21

Closed traversaro closed 8 years ago

traversaro commented 10 years ago

All input parameters of pointer type of wholeBodyModel should be declared as constant pointers to constant data.

DanielePucci commented 10 years ago

+1 On 20/02/2014 15:54, Silvio Traversaro wrote:

All pointers of input parameters in wholeBodyModel should be declared as constant pointers to constant data.

— Reply to this email directly or view it on GitHub https://github.com/robotology/codyco/issues/21.

"One should ignore whatever is going on on a set of measure zero." Henri Lebesgue

andreadelprete commented 10 years ago

Currently they are constant pointer to variables or pointer to constact variables? In the second case I don't see what the problem is...

traversaro commented 10 years ago

Currently they are plain pointers, for avoiding tragical implementations it is sufficient to turn them in pointers to constant variables, but making them also constant pointers is not bad (nel piu' ci stai il meno).

andreadelprete commented 10 years ago

ok, just remember that code has to be beautiful (especially if it's written for beautiful robots), and

bool f(const double *const x)

is not at all beautiful! I think @giorgiometta would agree with me on this!

lornat75 commented 10 years ago

i am not sure that the vector classes we use return const const pointers to double, if this is the case this change can have more side effects than expected.

traversaro commented 10 years ago

Ok, if double constness is ugly, making them simply pointers to const variables would be ok. @lornat75 Ok, when we will make the change I will properly test this aspects.

traversaro commented 8 years ago

Not going to happen.