RobotC has a function similar to this built in, but I think it only works with the three LEGO NXT motors.
http://www.education.rec.ri.cmu.edu/..._res_words.pdf
bFloatDuringInactiveMotorPWM = true; (or false; )
This is used to set whether the motors on the NXT will float or brake when there is no power applied.
There are two settings:
false - motors will brake when inactive
true - motors will float when inactive
Thanks for posting code that provides the same functionality for the 12V DC motors!