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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:34:04+00:00 2026-05-16T08:34:04+00:00

In C, unlike C++, all parameters to a function definition must be named. Instead

  • 0

In C, unlike C++, all parameters to a function definition must be named.

Instead of quashing “unused parameter” errors with (void)a, or openly using __attribute__((unused)), I’ve created the following macro:

#define UNUSED2(var, uniq) UNUSED_ ## line ## var __attribute((unused))
// squash unused variable warnings, can it be done without var?
#define UNUSED(var) UNUSED2(var, __func__)

Used like this

void blah(char const *UNUSED(path)) {}

Is there some way I can guarantee a unique “dummy” variable name (obviously LINE and __func__ can’t cut it), or neglect to name the unused variables at all?

Update0

The final code used is available here.

#ifdef __cplusplus
    // C++ allows you to omit parameter names if they're unused
#   define OMIT_PARAM
#else
    // A variable name must be provided in C, so make one up and mark it unused
#   define OMIT_PARAM3(uniq) const omitted_parameter_##uniq VARATTR_UNUSED
#   define OMIT_PARAM2(uniq) OMIT_PARAM3(uniq)
#   define OMIT_PARAM OMIT_PARAM2(__COUNTER__)
#endif

#ifdef _MSC_VER
#   define VARATTR_UNUSED
#else
#   define VARATTR_UNUSED __attribute__((unused))
#endif

It’s used like this:

void blah(char const *OMIT_PARAM) {}

And avoids both unused parameter, unnamed parameter warnings, and guarantees that it’s not going to clobber some other variable name.

  • 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-16T08:34:05+00:00Added an answer on May 16, 2026 at 8:34 am

    VC has a __COUNTER__ macro which gives uniqueness, it appears that GCC has an equivalent macro with the same name from version 4.3.5 (although I can’t at the moment find a live link).

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

Sidebar

Ask A Question

Stats

  • Questions 506k
  • Answers 506k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Does it have to be Relative Layout? I would suggest… May 16, 2026 at 3:38 pm
  • Editorial Team
    Editorial Team added an answer It would be best here to check to see if… May 16, 2026 at 3:38 pm
  • Editorial Team
    Editorial Team added an answer Yes, you need to implement heightForRowAtIndexPath. It is called to… May 16, 2026 at 3:38 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Unlike the other posts about the task delete all tables, this question is specifically
In my current project, I'm producing weekly releases. I've been using the technique described
I want to write a (gmake) makefile for a compiler that - unlike gcc
Unlike many of the ASP.NET documentation and examples, I'm doing a gridview list on
Alan Kay points out that Unlike Java, [Squeak] runs bit-identical on every machine --
I've read that all stl containers provide a specialisation of the swap algorithm so
I currently have a deep object, and it is all unicode (sadly). I am
Im using WCF REST 4.0 meaning to say their is no .svc file.. So
I have a multi-threaded application build in C# using VS2010 Professional. It's quite a
This might be too opinionated a question, but looking for help! I have been

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.