Click here to Skip to main content
15,885,985 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Anyone know of a good commercial debugger? Pin
Kevin McFarlane2-Jun-06 0:21
Kevin McFarlane2-Jun-06 0:21 
QuestionActiveX Control Debug version problem Pin
Andrew Hoole1-Jun-06 6:47
Andrew Hoole1-Jun-06 6:47 
AnswerRe: ActiveX Control Debug version problem Pin
Cedric Moonen1-Jun-06 7:21
Cedric Moonen1-Jun-06 7:21 
GeneralRe: ActiveX Control Debug version problem Pin
Andrew Hoole2-Jun-06 6:43
Andrew Hoole2-Jun-06 6:43 
Questionwave sound ... Pin
M_Nuaimi1-Jun-06 5:48
M_Nuaimi1-Jun-06 5:48 
AnswerRe: wave sound ... Pin
Zac Howland1-Jun-06 5:56
Zac Howland1-Jun-06 5:56 
QuestionRe: wave sound ... Pin
David Crow1-Jun-06 7:15
David Crow1-Jun-06 7:15 
QuestionWhy have they done this? Pin
RChin1-Jun-06 5:24
RChin1-Jun-06 5:24 
So I'm going through the source code for the Log4CPlus logging library and found this snippet:
#define LOG4CPLUS_DEBUG(logger, logEvent) \
    do { \
        if(logger.isEnabledFor(log4cplus::DEBUG_LOG_LEVEL)) { \
            log4cplus::tostringstream _log4cplus_buf; \
            _log4cplus_buf << logEvent; \
            logger.forcedLog(log4cplus::DEBUG_LOG_LEVEL, _log4cplus_buf.str(), __FILE__, __LINE__); \
        } \
    } while(0);

This of course logs a given string to the active logging class. The question is why have they wrapped all that in a do-while loop?

If you look at the loop, it will only be called once (while(0)). Is this some kind of preventitive measure to ensure that the compiler or optimiser does not strip the macro code out?





I Dream of Absolute Zero

AnswerRe: Why have they done this? Pin
Viorel.1-Jun-06 5:34
Viorel.1-Jun-06 5:34 
GeneralRe: Why have they done this? Pin
RChin1-Jun-06 5:41
RChin1-Jun-06 5:41 
GeneralRe: Why have they done this? [modified] Pin
Zac Howland1-Jun-06 5:52
Zac Howland1-Jun-06 5:52 
GeneralRe: Why have they done this? [modified] Pin
RChin1-Jun-06 5:56
RChin1-Jun-06 5:56 
AnswerRe: Why have they done this? [modified] Pin
James R. Twine1-Jun-06 8:08
James R. Twine1-Jun-06 8:08 
GeneralRe: Why have they done this? [modified] Pin
Blake Miller1-Jun-06 8:18
Blake Miller1-Jun-06 8:18 
GeneralRe: Why have they done this? [modified] Pin
Zac Howland1-Jun-06 8:46
Zac Howland1-Jun-06 8:46 
AnswerRe: Why have they done this? Pin
toxcct1-Jun-06 5:46
toxcct1-Jun-06 5:46 
QuestionSDL window in MFC application. Pin
Manjunath S1-Jun-06 5:22
Manjunath S1-Jun-06 5:22 
QuestionRe: SDL window in MFC application. Pin
Hamid_RT1-Jun-06 5:51
Hamid_RT1-Jun-06 5:51 
AnswerRe: SDL window in MFC application. Pin
Cedric Moonen1-Jun-06 6:05
Cedric Moonen1-Jun-06 6:05 
GeneralRe: SDL window in MFC application. Pin
Hamid_RT1-Jun-06 6:10
Hamid_RT1-Jun-06 6:10 
GeneralRe: SDL window in MFC application. Pin
Cedric Moonen1-Jun-06 6:11
Cedric Moonen1-Jun-06 6:11 
GeneralRe: SDL window in MFC application. Pin
Hamid_RT1-Jun-06 20:02
Hamid_RT1-Jun-06 20:02 
AnswerRe: SDL window in MFC application. [modified] Pin
toxcct1-Jun-06 6:19
toxcct1-Jun-06 6:19 
GeneralRe: SDL window in MFC application. Pin
David Crow1-Jun-06 7:21
David Crow1-Jun-06 7:21 
GeneralRe: SDL window in MFC application. Pin
toxcct1-Jun-06 7:24
toxcct1-Jun-06 7:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.