Using temporary adresses

What you wrote is fine, ewjordan, but could (depending on object type) cause extra copying. If the copy constructor is expensive, this could be undesirable (incidentally, the copy constructor for b2BoxDef and b2BodyDef are already being called once upon leaving their factory functions). My version is guaranteed to not cause any extra copy constructor calls. Either one is correct, but since I was attacking the temporary variable problem and how to make them live longer, I didn't really consider another option.
From my experiance, when I started saving the variables I intended to be temporary to variables... and then overwrote them when I wanted to make the next object... I started having errors. Thinking about the errors I had I'm not entirely sure why I had them, but I came to the conclusion that you cannot use temporary varaibles to define objects... even if they are not technically temporary varaibles. All I know is I further modified my code to store the definitions in each their own variables and it started working right. So, I personally have given up on temporary variables for this use.

Original thread: https://box2d.org/forum/viewtopic.php?t=330