gpt4 book ai didi

c++ - 在 C++ 中,严格的自底向上分析如何暗示返回类型不用于重载决策?

转载 作者:可可西里 更新时间:2023-11-01 18:29:25 25 4
gpt4 key购买 nike

在 Bjarne 的 book ,他说,

The insistence on strict bottom-up analysis implies that the return type is not used in overloading resolution.

看起来“自下而上的分析”与编译器如何解析 C++ 代码有关。

他这么说是什么意思?

问候。

最佳答案

“自下而上的分析”特别意味着必须在包含表达式的类型之前确定子表达式的类型,例如,如果我们有一个表达式 g(f()) f() 的类型必须在编译器开始为 g() 重载解析之前确定。如果我们有:

int f();
float f();

void g(float);

// Even though g() accepts only float, bottom-up analysis implies that
// this information is not available during resolution of f().
g(f());

关于c++ - 在 C++ 中,严格的自底向上分析如何暗示返回类型不用于重载决策?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25548864/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com