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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:12:20+00:00 2026-05-25T01:12:20+00:00

I have this code… void drawMap(void) { if (false) return; for(auto iter = this->m_layers.begin();

  • 0

I have this code…

void drawMap(void)
{
    if (false)
        return;

    for(auto iter = this->m_layers.begin(); iter != m_layers.end(); ++iter)
    {
        if ((*iter)->get() == NULL)
            continue;
        PN::draw((*iter)->get(), b2Vec2(0,0), true, 0);
    }
}

If I’m not mistaken it should NEVER execute…but it does…and when I change

    if (false)
      return;

to

    if (false)
       return;
    else
       return;

it doesn’t execute at all now, but how can that first statement NOT be false? grabs headache pills

P.S. I only did this ’cause I was debugging and noticed my code was drawing to the screen when it wasn’t supposed to.

  • 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-25T01:12:21+00:00Added an answer on May 25, 2026 at 1:12 am

    if (false) will never execute its body… because the value of the condition is never true. So in the code you’ve given, the remainder of drawMap will always execute because it will never return at the start.

    Consider if (x == 5) – that will only execute if the expression x == 5 is true. Now substitute false for x == 5…

    If you want an if statement which will always execute, you want

    if (true)
    

    instead.

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

Sidebar

Related Questions

I have this code to get a row from a JTable that is generated
I have this code somewhere in my plugin: $('tr', $this).hover(function(){ var cur_color = null;
I have this code: dojo.declare(City, null, { constructor : function(cityid, cityinfo){ } }); dojo.declare(TPolyline,
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have this code, that draws an image. private void timer1_Tick(object sender, EventArgs e)
i have this code which doesnt work: void CAnalyzerIF::SetData(int i_iIters, const CParameterSet* i_CParameterSet) {
I have this code & I've tired using JQuery's appendTo() function to get this
I have this code in my routes.db file: resources :users do member do get
I have this code in my controller: [HttpGet] public ActionResult Register(UserRegistrationModel model) { return
I have this code in jQuery, that I want to reimplement with the prototype

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.