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

  • Home
  • SEARCH
  • 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 8204019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:45:38+00:00 2026-06-07T07:45:38+00:00

Using C++, I need a macro that will replace a function to do nothing

  • 0

Using C++, I need a macro that will replace a function to do nothing if it is running in release mode. So, in debug mode the function will be executed, but in release mode it will not.

Something like this:

static void foo(int,int)

#ifdef NDEBUG
#define foo(x,y)
#endif

…and the function body is defined in a separate .cpp file and is part of a class, which is why I think this isn’t working?

actual code..

header

static void ValidateInput(const SeriesID *CurrentSeries, const AEnum_TT_TICK_ROUND& roundType = TT_TICK_ROUND_NONE);

.cpp

void TTBaseTick::ValidateInput(const SeriesID *CurrentSeries, const AEnum_TT_TICK_ROUND& roundType)
{
#ifndef _DEBUG
if (!CurrentSeries)
{
  throw TTTick::Ex(TTTick::SeriesNull);
}
else if (CurrentSeries->precision <= 0)
{
    throw TTTick::Ex(TTTick::PrecisionInvalid);
}
else if(!roundType.IsValidValue(roundType))
{
    throw TTTick::Ex(TTTick::InvalidParam);
}
#endif
}
  • 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-07T07:45:39+00:00Added an answer on June 7, 2026 at 7:45 am
    static void foo(int,int); // declaration
    
    
    
    // Definition in your cpp file.
    void foo( int x, int y )
    {
    #ifndef NDEBUG
        // Code for debug mode
    #endif
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using CodeIgniter and need an easy to implement captcha. Something simple, nothing too
I created a macro that will apply a particular style to whatever is selected
I'm working on a Word 2007 template with a macro that will apply character
I've developed an equation parser using a simple stack algorithm that will handle binary
I have a wpf application using Caliburn.Micro. I need to bind a ListBox to
Using C++ I need to combine two distinct IDs into one 16bit integer. Then
Using Regex I need to remove the last folder from a path: Example :
Using SQLite I need to copy nearly all of an existing row from a
using jquery I need to retrieve an array from table cells, format the data
Using Python I need to insert a newline character into a string every 64

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.