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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:57:43+00:00 2026-06-01T07:57:43+00:00

In our cross-platform c-project we are using the macro for the logging purposes: #if

  • 0

In our cross-platform c-project we are using the macro for the logging purposes:

#if _WINDOWS
    #define DEBUG_PRINTF(x) KdPrint(x)
#endif

The DEBUG_PRINTF usage example:

DEBUG_PRINTF(("Message with param (%s)\n", pString)); //            (1)
DEBUG_PRINTF(("Message with no param\n")); //                       (2)

It is ok. According to the KdPrint function reference a call to KdPrint requires double parentheses:

KdPrint (( Format, arguments ))
KdPrintEx (( DPFLTR_DEFAULT_ID, DPFLTR_INFO_LEVEL, Format, arguments ))

My question is how to deal with already existed macros such as (1) and (2) by porting the DEBUG_PRINTF on other platform such as linux in userspace?

For example the definition

#if defined (__LINUX__)
    #define DEBUG_PRINTF((x)) fprintf(stderr, x)
#endif

does not compile for macros such as (1).

  • 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-01T07:57:44+00:00Added an answer on June 1, 2026 at 7:57 am

    I would do it the other way around:

    #if _WINDOWS
        #define DEBUG_PRINTF(x) KdPrint((x))
    #else
        #define DEBUG_PRINTF(format, ...) fprintf(stderr, format, ##__VA_ARGS__)
    #endif
    

    Usage:

    DEBUG_PRINTF("Message with param (%s)\n", pString);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What are some good authoring tools for creating cross-platform help files for end-users? (Our
My team and I have found that documenting our project (a development platform w/
I am implementing a cross platform scripting language for our product. There is a
In our project now we using log4cxx, but those library don't develope some years,
We are considering moving the win32 build of our cross-platform C++ application from MS
We need a cross platform solution for compressing files. Our server runs on Windows
One of our projects is a cross-platform piece of code. We build it on
we are looking for a cross platform video framework to add to our application,
We our going to start a new project in our small team: It's a
I am evaluating the technology our company will be using for Android and iOS

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.