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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:49:26+00:00 2026-06-04T18:49:26+00:00

I forget where now, but I read somewhere that for(;;){…} is the same as

  • 0

I forget where now, but I read somewhere that for(;;){...} is the same as saying while(1){...}. This answer confirms that this is true and explains why for(;;) works at all. However, it doesn’t elaborate on why it would be useful, and I can’t seem to find any benchmarks for the empty for loop as opposed to the while loop.

It’s rather confusing (although admittedly quite clever), but it is shorter. Google’s Closure Compiler converts while(true) to empty for loops, so there must be a reason.

tl;dr: Why should I use an empty for loop over a while(1) loop?

  • 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-04T18:49:27+00:00Added an answer on June 4, 2026 at 6:49 pm

    It’s shorter to type. That’s really the only reason. A lot of people just grew up programming that way and it’s a matter of habit.

    I vaguely remember there being a time and language where for(;;) was faster. But that’s by and large in the past now with any half-decent optimizing compiler/interpreter.

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

Sidebar

Related Questions

If you read this thread before - forget everything I wrote , I must
I read a guide . It says that run the following line and forget
This is not a biggie at all, but something that would be very helpful
This article showed me how to install fonts from a script, but now I'm
I know, it looks awful but it worked for a while. But now the
I always forget how to do things like this. I have a database table
I've been using File.ReadAllText() to open a CSV file, but every time I forget
Most of time, the source of file uploading errors are that we forget to
Firstly, this DB question could be a bit DB agnostic, but I am using
(Title and contents updated after reading Alex's answer) In general I believe that it's

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.