This is more a artifact of the language, rather than a programmer oriented feature.
For python and javascript, the new variable means allocate an entry in the name dictionary, until you actually create an object and assign it. In C++ there is no name dictionary in the run-time, the definition needs to actually allocate memory for the object (and it could be a 10MB array for all we know).
This does allow C++ to fit into smaller memory footprint if you really need that. Otherwise there's no much reason to think about it.
From the developer's perspective you have a bug. Your x
has 2 meanings. Programming is hard enough as it is without having variables change meaning on you, so I would avoid as much as possible. I think C++ would give you a warning in some such a cases.
In practice you would get used to either setup.