gpt4 book ai didi

c++ - sizeof(function) 有意义吗?

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:09:22 24 4
gpt4 key购买 nike

我对 sizeof(function) 有点困惑。我曾经认为 sizeof 运算符对类对象、指针和引用进行操作

sizeof 运算符可以操作哪些操作数

sizeof(function) 有意义吗?

最佳答案

根据:http://en.cppreference.com/w/cpp/language/sizeof

"...sizeof cannot be used with function types, incomplete types, or bit-field glvalues"

或来自 2012 年 C++ 标准工作草案 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3337.pdf :

Section 5.3.3 Sizeof "The sizeof operator shall not be applied to an expression that has function or incomplete type, to an enumeration type whose underlying type is not fixed before all its enumerators have been declared, to the parenthesized name of such types, or to an lvalue that designates a bit-field."

关于c++ - sizeof(function) 有意义吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50885192/

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