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 6194295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:16:22+00:00 2026-05-24T03:16:22+00:00

I want to realize logging in my project. I have macro, smth like __LOG_TRACE(lg,

  • 0

I want to realize logging in my project.
I have macro, smth like

__LOG_TRACE(lg, expr,...) LOG_TRACE_STREAM(lg) << expr;

So I want to realize interface for this macro – another macro, but I want to support 2 types:

LOG_TRACE(msg);
LOG_TRACE(my_logger, msg);

I have some global logger, and first macro will write msg using global logger.
Second macro will take my_logger and write msg using it.

I can make it with LOG_TRACE(msg, my_logger); – but it’s not good, it’s harder to read in code. Order of arguments in __LOG_TRACE is not necessary.

Upd:
I don’t mean overloading macros.
Look – for example I can do this

#define LOG_TRACE(...) __LOG_TRACE(__VA_ARGS__, current_active)

Now I can write

LOG_TRACE(msg);
LOG_TRACE(msg, logger);

But I want not msg,logger and logger,msg

  • 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-05-24T03:16:23+00:00Added an answer on May 24, 2026 at 3:16 am

    Macro overloading is not allowed in C or C++. But there are workarounds. Here’s an article that will help you “overload” your macro: http://cplusplus.co.il/2010/08/31/overloading-macros/

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

Sidebar

Related Questions

i want to realize a construct in MS SQL that would look like this
I have a best practices question. I realize this is subjective but wanted to
What I want to realize is the following: In a JSP x I have
I want to realize a simple client-server connection using Nodejs. But I've encountered with
In Apple sample code project: MoviePlayer , I want to realize that, when the
I have to work on an prop. binary file format and want to realize
I want to realize a simple login in on facebook. I have a button
I want to realize this class into php extension: class MyClass { protected $attrs
I want to realize IDEA algorithm in Python. In Python we have no limits
I want to realize this function: calculate the average value(or the sum) rgb value

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.