Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
const_cast 和 UB
5 2 11 7 注 取决于 对象的类型 写操作 通过指针 左值或指针 到由 a 产生的数据成员 const cast 抛弃 a const 限定符68 may生产 未定义的行为 7 1 5 1 本节 C 03 的措辞令我惊讶 令人惊讶的是
c
undefinedbehavior
constcast
此示例中的 printf 语句是否调用未定义行为?
源自这个问题 https stackoverflow com questions 53747225 p is a pointer to a structure what do all these code snippets do 53747
c
undefinedbehavior
reinterpret_cast 能否将无效的指针值转换为有效的指针值?
考虑这个联盟 union A int a struct int b c c and a不是布局兼容 https timsong cpp github io cppwp n4659 basic types 11类型 因此无法读取其值b通过a
c
pointers
languagelawyer
C17
undefinedbehavior
int** 和 const int** 可以使用别名吗?
据我了解 这样的事情是可以的 const int ci 42 const int cip ci int ip int cip int j ip 那这个呢 const int ci 42 const int cip ci const int
c
constants
languagelawyer
undefinedbehavior
strictaliasing
是类型名称=名称;在 C++ 中有用过吗?
C 中允许使用以下代码 int a a or Type name name 两者都会导致未初始化的对象自行初始化 这通常会导致未定义的行为 这样的代码是否需要或合理 此类代码是否有用 这让我想起了一个老GCC 邮件列表主题 http gcc
c
variables
initialization
declaration
undefinedbehavior
Rust 中的严格别名?
我的理解是 由于所谓的 严格别名规则 以下代码在 C 中具有未定义的行为 include
Rust
undefinedbehavior
strictaliasing
临时和表达行为
这是明确定义的行为吗 const char p std string Hello std string World c str std cout lt lt p 我不知道 原因 不 这是未定义的行为 两个都std string临时对象和返回
c
undefinedbehavior
temporary
返回局部变量行为的地址[重复]
这个问题在这里已经有答案了 可能的重复 局部变量的内存可以在其作用域之外访问吗 https stackoverflow com questions 6441218 can a local variables memory be access
c
pointers
scope
undefinedbehavior
localvariables
对 NULL 值(或未定义)指针进行 Realloc
我正在读关于realloc http en cppreference com w c memory realloc并对那里提到的一点感到困惑 考虑下面的代码 include
c
undefinedbehavior
realloc
C 语言的接口
我正在设计一个应用程序并遇到一个实施问题 我有以下结构定义 app h struct application t void run application struct application t void stop application
c
struct
languagelawyer
undefinedbehavior
通过指向错误函数类型的指针调用函数(未知)
我有一个动态链接到库的程序 该程序将函数指针传递给该库以执行 但 ubsan 未定义行为清理程序 指定该指针位于不正确的函数类型上 而这种情况只会发生 如果回调函数有一个类作为参数 如果回调函数有一个类作为参数 但仅向前声明 如果我指定编译
c
pointers
undefinedbehavior
ubsan
如果 T 的第一个字段是 C,则将 struct T* 转换为 struct C* 是否是未定义行为?
在尝试使用 Speex 调试问题时 我注意到它 不仅仅是 Speex 还有一些示例代码 执行以下操作 从初始化函数返回指向 EncState 的指针 将该指针转换为 void 指针 存储void指针 别处 将 void 指针转换为指向 Sp
c
undefinedbehavior
speex
`x? 1 : 0` 变成了 40,未定义的行为?
我写了这段代码 include
c
undefinedbehavior
在同一表达式中调用具有局部副作用的函数两次是否是未定义的行为?
int f static int i 0 return i int g return f f Does g return 3或者是结果undefined 章节和诗句 http www open std org jtc1 sc22 wg14
c
undefinedbehavior
读取不确定的值是未定义的行为吗?
该问题出现在该问题答案的评论中当类型转换为 int 时 C C bool 类型是否始终保证为 0 或 1 https stackoverflow com questions 4276207 is c c bool type always g
c
initialization
undefinedbehavior
通过预定义的静态地址访问寄存器在 C++ 中是未定义的行为吗?
我正在编译一个 C 程序以在独立环境中运行 并且我正在运行的 CPU 定义了一个可用的 32 位外设寄存器 编辑 内存映射 at PERIPH ADDRESS 正确对齐 并且不与任何其他 C 对象 堆栈等重叠 我编译以下代码PERIPH A
c
languagelawyer
undefinedbehavior
volatile
memorymapping
为什么定义数组之外的第一个元素默认为零?
我正在准备 C 入门课程的期末考试 我们的教授给了我们这个问题来练习 解释为什么代码会产生以下输出 120 200 16 0 using namespace std int main int x 120 200 16 for int i 0
c
Arrays
initialization
undefinedbehavior
zeroinitialization
虚拟析构函数和未定义的行为
这个问题不同于 我何时 为何应该使用virtual析构函数 struct B virtual void foo B lt not virtual struct D B virtual void foo D B p new D delete
c
undefinedbehavior
virtualdestructor
C++20 中严格的别名规则是否允许标准 c++ unicode 字符和下划线类型之间的“reinterpret_cast”?
Do the C 20 s 严格的别名规则 基本 lval 11 http eel is c draft expr prop basic lval 11任意允许以下 之间投射char and char8 t string str strin
c
undefinedbehavior
strictaliasing
C20
在带有初始化的声明中,我可以使用对未初始化数据的引用吗?
我有一个创建并返回一个对象的函数 它还有一个副作用 将成功标志写入布尔变量 struct MyObject int field1 char field2 bool field3 MyObject CreateMyObject bool su
c
reference
initialization
undefinedbehavior
«
1 ...
4
5
6
7
8
9
10
11
»