Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8792277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:57:27+00:00 2026-06-13T22:57:27+00:00

#ifdef _DEBUG // calls appropriate functions for message logging #define LOGMESSAGE( stdStr ) gLogger.LogMessage(

  • 0
#ifdef _DEBUG
// calls appropriate functions for message logging
#define LOGMESSAGE( stdStr ) gLogger.LogMessage( stdStr, __FILE__, __LINE__ );
// calls appropriate function for success logging
#define LOGSUCCESS( stdStr ) gLogger.LogSuccess( stdStr, __FILE__, __LINE__ );
// calls appropriate function for error logging
#define LOGFAILURE( stdStr ) gLogger.LogFailure( stdStr, __FILE__, __LINE__ );
#endif

#ifdef NDEBUG
// does nothing in release mode
#define LOGMESSAGE( stdStr )
// does nothing in release mode
#define LOGSUCCESS( stdStr )
// Logs failures in release mode
#define LOGFAILURE( stdStr ) gLogger.LogFailure( stdStr, __FILE__, __LINE__ );
#endif

Say I call the macros like the following

if ( SomeFunc() )
    {
    LOGSUCCESS("Success calling SomeFun()");
    }
else
    {
    LOGFAILURE("Failure calling SomeFun()");
    }

In release mode LOGSUCCESS is blank so does that mean “Success calling SomeFunc()” string isn’t compiled into the code and won’t exist in the compiled code, or is that left over, but the macro doesn’t do anything with it?

EDIT:
I mean does it effectively leave the code like this in release mode?

if ( SomeFunc() )
    {
    "Success calling SomeFun()";
    }
else
    {
    gLogger.LogFailure("Failure calling SomeFun()", __FILE__, __LINE__ );
    }

or

if ( SomeFunc() )
    {

    }
else
    {
    gLogger.LogFailure("Failure calling SomeFun()", __FILE__, __LINE__ );
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:57:28+00:00Added an answer on June 13, 2026 at 10:57 pm

    It will be expanded to –

    if ( SomeFunc() )
        {
    ; //Remember the semicolon here
        }
    else
        {
        gLogger.LogFailure("Failure calling SomeFun()", __FILE__, __LINE__ );
        }
    

    The macro resolution is a pre-compile time activity, which just replaces the definition into the code before compilation starts.

    You have not associated any “meaning” to your debug dynamic information in the macro – so it is not used at all.

    To put it in simple term, macro is just a “search and replace” kind of activity during pre-compilation. Now since the str is not defined in the macro, it is not “used”. Since it is a kind of pre-compile time activity,the question of temporary variable does not arise.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

#ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif Why
I have a header file like this: #ifndef __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__ #define __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__ #ifdef _DEBUG //
I have this code: #ifdef _DEBUG #define _SECURE_SCL 1 #define _SECURE_SCL_THROWS 1 #else #define
For debug logging, I have often seen and used something like #ifdef DEBUG #define
I have the following code snippet: #ifdef DO_LOG #define log(p) record(p) #else #define log(p)
For example, I define a macro: #ifdef VERSION //.... do something #endif How can
I'm sure alot of you are aware of the macro #ifdef DEBUG #define DebugLog(
I am using __declspec(dllimport/export) on a debug version of new as such: #ifdef _DEBUG
Which preprocessor define should be used to specify debug sections of code? Use #ifdef
I'm using IBM Quantify to try to compare run time of different function calls

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.