Given the following function, will each of the local variables be declared on the stack?
std::string reallyCoolFunction(unsigned int a) { if( a < 20 ) { std::string result1 = "This function is really cool"; return result1; } if( a >=20 && a <= 40 ) { std::string result2 = "This function is kind of cool"; return result2; } if( a > 40 ) { std::string result3 = "This function is moderately cool"; return result3; } std::string result4 = "This function really isn't that cool"; return result4; // remove warning } In this situation, only one std::string is actually required, do all 4 get allocated on the stack, or does only 1 get allocated?