Why #pragma optimize(“”, off)

前端 未结 4 1254
走了就别回头了
走了就别回头了 2021-02-04 03:16

I\'m reviewing a C++ MFC project. At the beginning of some of the files there is this line:

#pragma optimize(\"\", off)

I get that this turns o

4条回答
  •  说谎
    说谎 (楼主)
    2021-02-04 03:27

    Another alternative reason for these to be in a code base... Its an accident.

    This is a very handy tool for turning off the optimizer on a specific file whilst debugging - as Ray mentioned above.

    If changelists are not reviewed carefully before committing, it is very easy for these lines to make their way into codebases, simply because they were 'accidentally' still there when other changes were committed.

提交回复
热议问题