Undefined behaviour with const_cast

前端 未结 7 2231
孤街浪徒
孤街浪徒 2020-12-19 01:37

I was hoping that someone could clarify exactly what is meant by undefined behaviour in C++. Given the following class definition:

class Foo
{
public:
             


        
7条回答
  •  情话喂你
    2020-12-19 02:01

    Compilers may place const data in read only parts of memory for optimization reasons and attempt to modify this data will result in UB.

提交回复
热议问题