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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:17:01+00:00 2026-06-01T13:17:01+00:00

I have a system with many parameter sets macroized (macros of the form #define

  • 0

I have a system with many parameter sets “macroized” (macros of the form “#define name value,value,value). I would like to pass these to a macro, but when I do I get an error.

example:

void fn(int a, int b, int c){ return; }

#define MACRO_1(a, b, c) fn(a, b, c)
#define MACRO(...) MACRO_1(__VA_ARGS__)
#define PARAM1 1
#define PARAM2 2, 2
#define PARAM3 3, 3, 3

int main(int argc, char * argv[]){
   MACRO(0,0,0);
   MACRO(PARAM1,1, 1);
   MACRO(PARAM2,2);
   MACRO(PARAM3);
   return 0;
}

in Visual C I get:

1>c:\main.c(10): warning C4003: not enough actual parameters for macro 'MACRO_1'
1>c:\main.c(10): error C2059: syntax error : ','
1>c:\main.c(11): warning C4003: not enough actual parameters for macro 'MACRO_1'
1>c:\main.c(11): error C2059: syntax error : ','
1>c:\main.c(12): warning C4003: not enough actual parameters for macro 'MACRO_1'
1>c:\main.c(12): error C2059: syntax error : ','
1>c:\main.c(13): warning C4003: not enough actual parameters for macro 'MACRO_1'
1>c:\main.c(13): error C2059: syntax error : ','
  • 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-01T13:17:03+00:00Added an answer on June 1, 2026 at 1:17 pm

    This is a bug in the Visual C++ compiler. The compiler does not correctly expand the variadic argument pack when __VA_ARGS__ appears as an argument to another macro.

    The workaround is to use an additional layer of indirection to force the variadic argument pack to be expanded before MACRO_1 is invoked:

    #define MACRO_1(a, b, c) fn(a, b, c)
    #define MACRO_1_(args_list) MACRO_1 args_list
    #define MACRO(...) MACRO_1_((__VA_ARGS__))
    

    There is a Microsoft Connect bug for this issue: Variadic Macro Replacement (Wayback Machine). If this issue is important to you, please upvote that bug report.

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

Sidebar

Related Questions

I have a system that has many components interacting with each other. It occured
We have a content delivery system that delivers many different content types to devices.
I have a category system that is related many-to-many with posts. How can I
As many of you probably know, online banks nowadays have a security system whereby
I am a newbie in cryptographic system but i have seen many sources tell
Suppose I have a function that has a parameter that is overloaded by many
We have code that is producing the following unhandled exception: Error Message: System.Reflection.TargetParameterCountException: Parameter
I have many routes like: //routes app.get(page1/:action, function(req, res) { ... } app.get(page2/:action, function(req,
I have a function that takes another function as a parameter. Something like this
I have a support environment where we connect to many of our customers' systems

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.