However, it is still undefined behavior.它应该永远不会出错,而且永远不能出现未定义的行为。
It should never fail and never exhibit undefined behaviour.
Undefined behavior occurs when trying to use the variable.
If you break the last statement you will get undefined behaviour.Combinations with other parts of speech
(为什么)在C中使用未初始化的变量未定义的行为??
(Why) is using an uninitialized variable undefined behavior?
We believe that programmers should avoid undefined behavior.
Actually you have undefined behavior.
The following are considered undefined behavior by the ISO C Standard:.
This is no undefined behavior.
Failure to do so will result in undefined behavior.Increment-为什么这些结构(使用++)在C中是未定义的行为?
Stack Overflow: Why are these constructs(using++) undefined behavior?这对于整数乘法是合法的,因为两个补码溢出是未定义的行为。
This is legal for integermultiplication because two's complement overflow is undefined behaviour.我想要让大家看到C的那些阴暗角落比我们想象中更近,甚至那些平常的代码中就包含着未定义的行为。
I want to show that the dark corners of C are much closer than it seems,and even trivial code lines may contain undefined behavior.当这种情况发生时,ØMQ的两个实例访问相同的变量,导致竞态条件,奇怪的错误和未定义的行为。
When such a situation occurs, both instances of ØMQ access the same variables, resulting in race conditions,strange failures and undefined behaviour.从诸如的左值移动a是危险的,因为我们以后可以尝试通过调用成员函数a,调用未定义的行为。
Moving from lvalues such as a is dangerous, because we could later try to call a member function via a,invoking undefined behavior.上述解决方案在C/C++中是错误的,因为它会导致未定义的行为(编译器可以以任何方式自由行事)。
The above solution is wrong in C/C++ as it causes undefined behaviour(compiler is free to behave in any way).此外,“C带来了一些令人担忧的包袱、未定义的行为,以及其他导致安全缺陷和脆弱基础设施的弱点。
In addition,"C comes with some worrisome baggage, undefined behaviors, and other weaknesses that lead to security flaws and vulnerable infrastructure.".在这两种情况下,任何进一步访问(包括对fclose()另一个调用)都会导致未定义的行为。
In either case any further access(including another call to fclose())to the stream results in undefined behaviour.任何尝试修改具有临时生命周期的对象都会导致未定义的行为。
Any attempt to modify an object with temporary lifetime results in undefined behavior.执行FD_CLR()或FD_SET()的值为负值或等于或大于FD_SETSIZE将导致未定义的行为。
Executing FD_CLR() or FD_SET() with a value of fd that is negative or is equal to orlarger than FD_SETSIZE will result in undefined behavior.传递无效的或过期的thread_id可能会导致未定义的行为,例如段错误。
Passing an invalid or expired thread_id may result in undefined behavior, such as segmentation fault.问题是npos与非错误的结果并非同一类型,以致它在安静的传递给string::substr函数时导致一个未定义的行为。
The problem is that npos is of the same type as a non-error result,so it can be passed quietly to string::substr causing undefined behavior.执行FD_CLR()或FD_SET(),其值为负值或等于或大于FD_SET-SIZE的值fd将导致未定义的行为。
Executing FD_CLR() or FD_SET() with a value of fd that is negative or is equal to orlarger than FD_SETSIZE will result in undefined behavior.
Those are all undefined definitions.此外,“C带来了一些令人担忧的包袱、未定义的行为,以及其他导致安全缺陷和脆弱基础设施的弱点。
With the kernel written in C,it comes with some worrisome baggage,"undefined" behaviors, and other weaknesses that lead to security flaws and vulnerable infrastructure.
In C this is Undefined Behavior.