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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:11:50+00:00 2026-06-03T12:11:50+00:00

I have seen example code like this before class C { C(); ~C(); foo(T1,

  • 0

I have seen example code like this before

class C
{
    C();
    ~C();
    foo(T1, T2);
}

C::foo(T1, T2)
{
    //not using T1/T2
}

versus conventional code like this

class D
{
    D();
    ~D();
    bar(T1 t1, T2 t2);
}

D::bar(T1 t1, T2 t2)
{
    //using t1 and t2
}

And I am wondering what is the purpose of not defining your type variables for usability? Do most people do this just to hint that those parameters of the api are not currently in use, but to ensure backward compatibility in the future?

Is it possibly for RTTI, or referencing static variables (although the various samples I’ve seen were not using it for this purpose, they werent even templated functions, the variables were simply unused). I’ve tried searching for this feature but I am not even sure what it is called or what to search.

Basically, what are the reasons/benefits/downsides for using this approach?

  • 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-03T12:11:52+00:00Added an answer on June 3, 2026 at 12:11 pm

    This is commonly done to suppress compiler warnings about unused variables. When you do not create a variable name, the compiler will not warn you that the variable is not being used in the function.

    Like you stated, its usually that parameters are not being used for the particular implementation:

    class an_iface
    {
    public:
        an_iface();
    
        virtual int doSomething(int valNeeded)=0;
    }
    
    #define NOT_SUPPORTED -1
    class something : public an_iface
    {
    public:
        something();
        int doSomething (int) { return NOT_SUPPORTED; }
    }
    
    class somethingMore : public an_iface
    {
    public:
        somethingMore();
        int doSomething(int stuff) { return stuff * 10; }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen this example on the web: $('#questionTextArea').each( function() { var $this =
Please give me some examples of jump table usage. I have seen this example
I have seen this asked before and seen many answer there is a facebook
I have seen the example here . All well and good and I understand
I have often seen the spinning gears OpenGL example ( I think originally done
Before I start I'd just like to state that the code created by ASP.NET
I have a static class which contains a RoutedUICommand that I would like to
I've seen somewhere how to do this before on a blog but I forgot
Let's say you have a piece of code like: resource = allocateResource(); try {
I'm sorry if this question has been asked before, but I'm not even sure

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.