RE: [GD-Windows] Strict ANSI and <windows.h>
Brought to you by:
vexxed72
From: Grills, J. <jg...@so...> - 2002-11-04 03:51:50
|
And there was much sadness. Here's some code from STLPort, but the problem is more generalized: template <class _Tp, class _Alloc > void _Deque_base<_Tp,_Alloc>::_M_create_nodes(_Tp** __nstart, _Tp** __nfinish) { _Tp** __cur; _STLP_TRY { for (__cur = __nstart; __cur < __nfinish; ++__cur) *__cur = _M_map_size.allocate(this->buffer_size()); } _STLP_UNWIND(_M_destroy_nodes(__nstart, __cur)); } Because of the if() clause, the compiler doesn't know that __cur is always going to be initialized in debug builds, and generates a warning on the last line in the function. So, it's not a perfect solution, but it still may be better than not having it. I'll have fix the errors as I come across them and decide if it is worth it or not... j -----Original Message----- From: Grills, Jeff Sent: Sunday, November 03, 2002 9:28 PM To: 'Pierre Terdiman'; Grills, Jeff; 'Jon Watte'; gam...@li... Subject: RE: [GD-Windows] Strict ANSI and <windows.h> Excellent! This works exactly as I desire. No compile warnings, and in the release build the disassembly doesn't show any sign of the if(False()){} at all. Time to go throw this in the header file that's always included, rebuild, and see how it works for the whole project. Thank you very much. j -----Original Message----- From: Pierre Terdiman [mailto:p.t...@wa...] Sent: Sunday, November 03, 2002 5:04 PM To: Grills, Jeff; 'Jon Watte'; gam...@li... Subject: Re: [GD-Windows] Strict ANSI and <windows.h> > My complaint about this technique is that I then have to disable warning > C4127: conditional expression is constant, something I'm not willing to do. > Anyone have a solution for that, but has no runtime impact? Maybe something like this : inline bool False(){ return false; } #define for if(False()){} else for You can also use a global extern variable instead of the inline function. You can also use this in Debug builds only, if you fear it adds a "runtime impact". Pierre |