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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:40:31+00:00 2026-06-11T12:40:31+00:00

I was just going through some C code, when I got stuck upon this

  • 0

I was just going through some C code, when I got stuck upon this piece of code.

void someFunction(Int32 someVariable)
{
    /* someVariable is hard coded to 2 */
    (void)someVariable;

    //some processing that has nothing to do with someVariable.
}

What does the author meant by the comment, “someVariable is hard coded to 2“?
What exactly is happening to someVariable?

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

    It means that the code used to look like this, for example:

    // Somewhere else in the source:
    …someFunction(2)…
    …
    …x = 2;…
    …someFunction(x)…
    …
    // Et cetera, the point being that whenever someFunction is called, its argument always has the value 2.
    
    // The definition of someFunction:
    void someFunction(Int32 someVariable)
    {
        foo(someVariable*3);
        y = someVariable*7 - 4;
        bar(y);
        …
    }
    

    and the author changed it to this:

    // The definition of someFunction:
    void someFunction(Int32 someVariable)
    {
        (void) someVariable;
        foo(6);
        y = 10;
        bar(y);
        …
    }
    

    So, what happened is:

    • Everywhere that “someVariable” appeared in “someFunction”, the author replaced it with “2”.
    • The author then reduced expressions, so that “someVariable*3” became “2*3” and then became “6”. This explains why you do not see “someVariable” in someFunction and why you do not see “2” in someFunction.

    In other words, the code of someFunction now behaves the way the original code behaved when someVariable was 2. You describe the body of someFunction as “some processing that has nothing to do with someVariable”, but, in fact, it is processing that uses 2 for the variable of someVariable. Whatever role someVariable played in the function has been lost by the editing, but, presumably, this code behaves like the old code did, as long as someVariable was 2.

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

Sidebar

Related Questions

I am new to C++. I was just going through some code and got
I was just going through some code and was wondering if it is bad
I know there isn't enough validation in here just going through some testing. $result
Just going through the sample Scala code on Scala website, but encountered an annoying
I was just going through some codes of C++. Where in I came across
Going through my code, I was hoping to remove instances where I do this:
I'm going through my app, trying to clean up some code that sends e-mails.
I am going through some code and changing the database part of it to
I was going through some old code of mine and came across a hybrid
I am just trying to learn some Lisp, so I am going through project

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.