gpt4 book ai didi

c - 什么时候指向同一个对象的指针相等?

转载 作者:太空狗 更新时间:2023-10-29 17:18:23 24 4
gpt4 key购买 nike

对于两个指向同一个对象或函数的指针ab,在这种情况下C标准保证a == b?当 ab 指向同一个对象时,是否有任何平台可以支持 a != b

最佳答案

根据 C 标准(来自 N1548 委员会草案的 6.5.9 相等运算符 — 2010 年 12 月 2 日 ISO/IEC 9899:201x)

6 Two pointers compare equal if and only if both are null pointers, both are pointers to the same object (including a pointer to an object and a subobject at its beginning) or function, both are pointers to one past the last element of the same array object, or one is a pointer to one past the end of one array object and the other is a pointer to the start of a different array object that happens to immediately follow the first array object in the address space.109)

关于c - 什么时候指向同一个对象的指针相等?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26960514/

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