Is it possible to completely disable the default C++ new operator?

前端 未结 4 1352
走了就别回头了
走了就别回头了 2021-02-01 14:03

Because our app has hard performance and memory constraints, our coding standards forbid the use of the default heap — ie, no malloc, no default new

4条回答
  •  不知归路
    2021-02-01 14:31

    Poison it!
    If you are using GCC, there is a pragma for this:

    #ifdef __GNUC__
    
    /* poision memory functions */
    #   pragma GCC poison malloc new
    
    #endif
    

提交回复
热议问题