How 'undefined' a race condition can be?

前端 未结 7 527
甜味超标
甜味超标 2021-01-03 02:49

Let\'s say I define a following C++ object:

class AClass
{
public:
    AClass() : foo(0) {}
    uint32_t getFoo() { return foo; }
    void changeFoo() { foo          


        
7条回答
  •  心在旅途
    2021-01-03 03:19

    Undefined behavior is guaranteed to be as undefined as the word undefined.
    Technically, the observable behavior is pointless because it is simply undefined behavior, the compiler is not needed to show you any particular behavior. It may work as you think it should or not or may burn your computer, anything and everything is possible.

提交回复
热议问题