Re: what does two semicolns ';;' do



Greetings, Ivan Sanchez Ortega.
In reply to Your message dated Saturday, June 28, 2008, 23:01:00,

for(;;){ // for([two semicolons){

what is the function of the two semicolons? loop until break?

The two semicolons are *part* of the "for" construct. See any books on C or
C++ about "for" loops.

That means that the initial statement, the break condition and the loop
statement in that loop are the empty statement.

That means that the for loop does not initialize anything when starting,
does not check for any break condition, and does not perform anything at
the end of each loop.

Which means, that's an infinite loop (until it's broken by calling the
break() construct inside the loop)

Ridiculous usage of the language construct...
Why not use

while(true){ ... }

then?


--
Sincerely Yours, AnrDaemon <anrdaemon@xxxxxxxxxxx>

.



Relevant Pages

  • Re: what does two semicolns ;; do
    ... what is the function of the two semicolons? ... I've tried to google it but the text filter seems to remove the ... Look up a for loop in the PHP doc. ... the expressions are null. ...
    (comp.lang.php)
  • Re: Help understanding this use of while
    ... Barry Schwarz writes: ... that the while loop will just occur once but then why use a while loop ... above (i.e. to watch his of her semicolons like a hawk) then what is ... while trick is to introduce a block that is ...
    (comp.lang.c)
  • How to create unique file names?
    ... I need to create unique file names while in a loop. ... producing files, all going at the same time. ... I want to remove all spaces, semicolons, and slashes. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: for loop
    ... The C-style forloop requires semicolons, not commas. ...
    (comp.lang.perl.misc)
  • Re: Letter to US Sen. Byron Dorgan re unpaid overtime
    ... >> considered to be a convenience by those who use the C language. ... I make no claims to being a VB.NET programmer. ... Ritchie SCREWED UP in designing the for loop because ... I do not believe that you are capable of writing a conforming C compiler. ...
    (comp.programming)