my thinking:
`http:` is the label (followed by a comment that the pre-processor strips
out)
`do { ... } while (...)` is the labelled statement
`continue <label>` attempts to transfer control back to the "continue
target". In this case, the labelled do/while loop
a `do {statement} while (expression)` loops will check its expression only
once the statement has executed normally (which it hasn't here)
So... the loop will begin again, and continue infinitely, or until an
exception is thrown or the JVM is terminated.
No stack involved, at the level of compiled machine code it'll be jump
instructions all the way down...
The language spec covering all this is here:
http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html
( or in pdf here:
http://java.sun.com/docs/books/jls/download/langspec-3.0.pdf )
For anyone still labouring under the delusion that Java is a simple
language, it's a heavyweight document; running to 650 pages in almost 8MB
but you only really need chapter 14 for this question :)
On 4 August 2010 05:43, Kirk <[email protected]> wrote:
> I'll be speaking there so I don't need a pass but thought it might be fun
> to put in a puzzler.
>
> public class StrangeLoop {
> public static void main(String[] args) {
> http://www.thestrangeloop.com
> do {
> System.out.println("Strange Loop");
> continue http;
> } while (false);
> }
> }
>
> Puzzler, infinite loop or normal termination?
>
> Regards,
> Kirk
>
> --
> You received this message because you are subscribed to the Google Groups
> "The Java Posse" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<javaposse%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/javaposse?hl=en.
>
>
--
Kevin Wright
mail/google talk: [email protected]
wave: [email protected]
skype: kev.lee.wright
twitter: @thecoda
--
You received this message because you are subscribed to the Google Groups "The
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/javaposse?hl=en.