thunder2020 / arducopter

Automatically exported from code.google.com/p/arducopter
0 stars 0 forks source link

completely unexpected and error prone implementation of AP_Param_::operator= #555

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I can't imagine any situation where it's desirable that
    a = b;
behaves like
    b;

The authors of RC_Channel::zero_min_max(); and AP_MotorsHeli::init_swash(); 
probably didn't except this kind of behavior as well.

Fix:
http://pastebin.com/Vmymw3U7

Additional comments:
- the AP_Param code isn't const-correct (e.g. fixed assignment operators, 
cast_to_float)
- I recommend to remove the conversion operator to prevent unexpected behavior 
when someone mistakes that object for a float or something like that and force 
the user to use the getter and implement the comparison operators.
- duplicate code could be eliminated by deriving AP_ParamT from AP_ParamV

Original issue reported on code.google.com by eilstach...@googlemail.com on 28 Feb 2013 at 3:15

GoogleCodeExporter commented 8 years ago
Closing all issues on the old issues list by marking them WontFix.

If this is still a valid issue please re-raise it on the new GitHub issues 
list: https://github.com/diydrones/ardupilot/issues

Thanks!

Original comment by rmackay...@gmail.com on 21 Jul 2013 at 2:14