【发布时间】:2026-01-07 19:10:02
【问题描述】:
struct SomeStruct
{
int a;
int b;
};
SomeStruct someFn( int init )
{
SomeStruct ret = { init, init };
//...
return ret;
}
void someFn2( SomeStruct* pStruct )
{
// ..
}
int main( )
{
someFn2( &someFn(32) );
return 0;
}
【问题讨论】:
-
对我来说看起来很有效,但你为什么不编译它并找出来?
-
定义“barfs”。您可以使用 -Wall (或编译器上的等效项)进行编译并查看是否有任何警告吗?如何发布您收到的确切错误消息。
-
@Daniel“它可以编译”和“它对我有用”并不是很好的有效性衡量标准。
-
埃文:你应该把它添加到你的问题中。
标签: c++ standards compiler-construction