警告:获取标签的地址是不标准的
warning: taking the address of a label is non-standard
有人能解释一下下面的代码是如何创建标签的吗?
char memory[] = "hello";
&&memory[0];
error: label 'memory' used but not defined
&&memory[0];
这不是有效的C++,因此一个一致的扩展可以为它分配任何想要的语义
碰巧的是,&&label
是GNU人员为计算goto(GNU扩展)获取标签地址的方式。
就是这样。
参考:https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
相关文章:
- 为什么cout输出内存地址不是字符串?
- C++ 临时地址不会导致生成错误
- 链表地址不是固定间隔的
- 指针不起作用,返回地址不是值
- 类别成员偏移地址不正确
- 本地变量的地址不在smaps显示的堆栈地址范围内
- 当基类不是多态但派生时,"this"地址不匹配是
- 获取基本地址不起作用
- 继承成员地址的C++标准
- 合法地转发声明 C 标准库实体,但不C++标准库实体
- C++变量地址不匹配
- C++ 获取处理地址不起作用
- 为什么使用 push_back() 赋值时向量元素的地址不连续
- QHost地址集地址不起作用
- 是否有保证堆分配的块地址不会改变(隐式)
- 为什么函数地址不是常量表达式
- 警告:获取标签的地址是不标准的
- 为什么数组的内存地址不总是增加呢?
- 地址不是我想要的内容
- 数组地址不可见