local variables are allocated on the stack on entry to the function and lost on exit therefore using such a returned pointer would destroy the stack integrity
given the above code the gcc compiler gives a warning
Code:
c1.cpp|3|warning: address of local variable 'name' returned|