Common reasons for bugs in release version not present in debug mode

后端 未结 18 1582
余生分开走
余生分开走 2020-11-28 04:11

What are the typical reasons for bugs and abnormal program behavior that manifest themselves only in release compilation mode but which do not occur when in debug mode?

18条回答
  •  北荒
    北荒 (楼主)
    2020-11-28 04:43

    Many times, in debug mode in C++ all variables are null initialized, whereas the same does not happen in release mode unless explicitly stated.

    Check for any debug macros and uninitialized variables

    Does your program uses threading, then optimization can also cause some issues in release mode.

    Also check for all exceptions, for example not directly related to release mode but sometime we just ignore some critical exceptions, like mem access violation in VC++, but the same can be a issue at least in other OS like Linux, Solaris. Ideally your program should not catch such critical exceptions like accessing a NULL pointer.

提交回复
热议问题