Re: [cpp] 请问:3000个try{}catch{}宏是否会影响程序的性能呢?

qiaojie qiaojie at gmail.com
Thu Dec 20 16:03:41 CST 2007


用这种方法记录出错点非常的傻


在07-12-20,Carl Liu(Henyep SZ) <xxliu at cn.henyep.com> 写道:
>
>  最近准备开发一个服务器程序,为了在程序崩溃时得到出错的代码位置(文件名,行数), 我想通过TRY/CATCH的机制自定义一个宏来实现。如下:
> #define rp(x) \
> try{x;}\
> catch (...)\
> {CString str; str.Format("Crashed on Line:%d,in File:%s",__LINE__,
> __FILE__) ;AddtoLog(str, LOG_RELEASE) ; exit(1) ;}
> 3000组左右的TRY/CATCH
> 这样,在程序中涉及到内存操作的代码都会加上这个宏 (如, rp( memcpy(dest,src,size_t))
> ;),大概会增加3000组左右的TRY/CATCH, 问题在于这3000~5000组左右额外的TRY/CATCH对性能的影响有多大?
>
>
>
>
> -----------------------------------
> Regards
>
>
>                     Carl
> -----------------------------------
>
>
>  ------------------------------
>
>
> _______________________________________________
> Cpp mailing list
> Cpp at codingnow.com
> http://codingnow.com/mailman/listinfo/cpp
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codingnow.com/pipermail/cpp/attachments/20071220/c1ed5c5f/attachment.html


More information about the Cpp mailing list