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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:10:23+00:00 2026-06-02T16:10:23+00:00

According to the doc , the while statement executes the block as long as

  • 0

According to the doc, the while statement executes the block as long as the expression is true. I wonder why it becomes an infinite loop with an empty expression:

while () { # infinite loop
 ...
}

Is it just inaccuracy in the doc?

  • 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-02T16:10:24+00:00Added an answer on June 2, 2026 at 4:10 pm
    $ perl -MO=Deparse -e 'while () { }'
    while (1) {
        ();
    }
    -e syntax OK
    

    It seems that while () {} and while (1) {} are equivalent. Also note that empty parens* are inserted in the empty block.

    Another example of pre-defined compiler behaviour:

    $ perl -MO=Deparse -e 'while (<>) { }'
    while (defined($_ = <ARGV>)) {
        ();
    }
    -e syntax OK
    

    I would say that this is just the docs not reporting a special case.

    * — To be precise, the stub opcode is inserted. It does nothing, but serves a goto target for the enterloop opcode. There’s no real reason to note this. Deparse denotes this stub op using empty parens, since parens don’t generate code.

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

Sidebar

Related Questions

According to a doc Emacs supports drag and drop: dropping a file into an
I'm using gem rapns (https://github.com/ileitch/rapns) on my rails app. According to rapns doc, I
According to doc and various answers here git difftool will invoke the specified executable
According to mongodb doc, syntax for $elemMatch would be, t.find( { x : {
According to the doc, the 'error' ajax event gets passed the XMLHttpRequest object, 'success'
According to doc, calendar set() is: http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Calendar.html#set%28int,%20int,%20int%29 set(int year, int month, int date) Sets
According to this doc page , Android 2.3 supports extra large screen sizes (xlarge),
i am trying out the async-feature in grails. According to http://grails.org/doc/2.0.0.M1/guide/introduction.html#webFeatures it is now
According the Wordpress' doc, when we create theme, we need to create style.css file
I'm using MPlayer in my java application. According to its doc, it's needed that

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.