lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re[2]: [lmi] more questions due to MSVC warnings


From: Vadim Zeitlin
Subject: Re[2]: [lmi] more questions due to MSVC warnings
Date: Sat, 29 Mar 2008 00:31:45 +0100

On Fri, 28 Mar 2008 12:20:29 +0000 Greg Chicares <address@hidden> wrote:

GC> Consider this code in 'test_main.cpp':
GC> 
GC>     int result;
GC> // GWC suppressed this because the borland compiler correcly warns
GC> // that the initializing value is unused.
GC> //    int result = 0;               // quiet compiler warnings
GC> 
GC>     try
GC>         {
GC>         result = test_main( argc, argv );
GC> 
GC> Would you leave that alone, or revert the change flagged with my
GC> initials and zero-initialize the variable explicitly?

 Unfortunately there is really no good answer to this question. In wx we
use wxDUMMY_INITIALIZE() macro which is defined differently for MSVC and
BCC and can be used like this:

        int result wxDUMMY_INITIALIZE(0);

This allows to avoid the warnings with all compilers and also avoids the
need to write the "quiet compiler warnings" comments. Obviously, it does
this at the price of making the code more ugly. I think using the macro is
worth the price, especially with the modern (or even ancient like ctags+vi
combination that I personally use) tools which allow you to immediately
jump to the macro definition which helps when you see it for the first
time.

 Regards,
VZ





reply via email to

[Prev in Thread] Current Thread [Next in Thread]