Robert, in your first example you are returning local which is a string, but your function returns a pointer to a string.
In your second example you have it the other way around, you return str which is a pointer to a string, but your function returns a string.
Maybe you did that intentionally, I must have misunderstood it then.
EDIT: BTW, thank you for the history lesson.
