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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:49:42+00:00 2026-06-15T19:49:42+00:00

I am using C++ Builder XE3. Currently I have such macro as below: #define

  • 0

I am using C++ Builder XE3.

Currently I have such macro as below:

#define LOGG(message, ...) OTHER_LIB_LOG(message,__VA_ARGS__)

Now I want to make all arguments be AnsiString.
It is easy for me to deal with the argument: message like below:

#define LOGG(message, ...) OTHER_LIB_LOG(AnsiString(message),__VA_ARGS__)

But for VA_ARGS, I do not know how to deal with the arguments to make sure all arguments which are put to OTHER_LIB_LOG are AnsiString.

It is hard for me to modify the source code of OTHER_LIB_LOG, so I have to do this with Macro.

Any help will be appreciated.

  • 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-15T19:49:43+00:00Added an answer on June 15, 2026 at 7:49 pm

    C macros don’t recurse. So you will have to do some manual work.
    Find the max number of arguments LOGG will take & use as below: My example takes max 6 arguments.

    #define ENCODE0(x) AnsiString(x)
    #define ENCODE1(x,...) AnsiString(x), ENCODE0(__VA_ARGS__)
    #define ENCODE2(x,...) AnsiString(x), ENCODE1(__VA_ARGS__)
    #define ENCODE3(x,...) AnsiString(x), ENCODE2(__VA_ARGS__)
    #define ENCODE4(x,...) AnsiString(x), ENCODE3(__VA_ARGS__)
    #define ENCODE5(x,...) AnsiString(x), ENCODE4(__VA_ARGS__)
    #define ENCODE6(x,...) AnsiString(x), ENCODE5(__VA_ARGS__)
    //Add more pairs if required. 6 is the upper limit in this case.
    #define ENCODE(i,...) ENCODE##i(__VA_ARGS__) //i is the number of arguments (max 6 in this case)
    
    #define LOGG(count,...) OTHER_LIB_LOG(ENCODE(count,__VA_ARGS__))
    

    Sample Usage: LOGG(5,"Hello","Hi","Namaste _/\_","Hola!","bonjour");

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

Sidebar

Related Questions

Using Flex Builder : I have created a new Actionscript Project. I want to
Friends i'm using string builder for generating Passenger List in which i have used
I need to create the below xml using builder, how would I do it?
Using report builder 3.0, I have a report that queries a cube. How do
I am using Flex Builder 3 and visual studio 2010 I have created webService.asmx
using Builder online tool https://builder.addons.mozilla.org/ to build and test my extension now that I
I have been using Flash Builder to build my flex software and I am
I'm using Flash Builder 4.5. In an .mxml file, if you want to use
Using C++ Builder under Rad Studio XE I have created a simple Datasnap server
I'm trying to build an AlertDialog using Builder. My dialog has to have multiple

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.