由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - Is this function's behavior undefined?
相关主题
inline functions in C++How to use a function return by reference in C++
遇到 Qt 下undefined reference to "func" 错误how much memory does it take to save the member function in a class ?
is this behavior undefined?What is wrong?
This slideshow answers most question about C (and some C++), esp Undefined behaviors.C++ template Questions (转载)
这个是undefined的吗?function in c++
__FUNCTION__ 是怎么回事呀?return value of a python function...
pointer to function问个C++ virtual function的问题 (转载)
[合集] C/C++ calling function by nameOne question in C programming
相关话题的讨论汇总
话题: undefined话题: behavior话题: function话题: string话题: aaaaaaa
进入Programming版参与讨论
1 (共1页)
f******y
发帖数: 2971
1
const std::string& func()
{
return("AAAAAAA");
}
I know it is fine if the return type is char*. How about the string
reference?
X****r
发帖数: 3557
2
yes, undefined
never return a reference to a temporary

【在 f******y 的大作中提到】
: const std::string& func()
: {
: return("AAAAAAA");
: }
: I know it is fine if the return type is char*. How about the string
: reference?

p*********t
发帖数: 2690
3
string是一个class! "AAAAAAA"不是一个class的object !

【在 f******y 的大作中提到】
: const std::string& func()
: {
: return("AAAAAAA");
: }
: I know it is fine if the return type is char*. How about the string
: reference?

1 (共1页)
进入Programming版参与讨论
相关主题
One question in C programming这个是undefined的吗?
C++ function template问题__FUNCTION__ 是怎么回事呀?
这个function pointer最后的那个int是什么意思?pointer to function
javascript真是太爽了[合集] C/C++ calling function by name
inline functions in C++How to use a function return by reference in C++
遇到 Qt 下undefined reference to "func" 错误how much memory does it take to save the member function in a class ?
is this behavior undefined?What is wrong?
This slideshow answers most question about C (and some C++), esp Undefined behaviors.C++ template Questions (转载)
相关话题的讨论汇总
话题: undefined话题: behavior话题: function话题: string话题: aaaaaaa