By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,129 Members | 2,300 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,129 IT Pros & Developers. It's quick & easy.

how to do an infinite loop

P: n/a
please everybody ,can anyone tell me how to do an infinite loop in C

Mar 1 '06 #1
Share this Question
Share on Google+
59 Replies


P: n/a
while (1)
{
// you code here
}

Mar 1 '06 #2

P: n/a
rami wrote:
please everybody ,can anyone tell me how to do an infinite loop in C


well the obvious way that applies to pretty well any programming
language
(I'm sure some will take it as a challange to give a counter example
(*)
is to use a while statement.

while (expression)
statement;

This executes "statement" while "expression" is true. So all you have
to
do is choose an expression that is always true

while (1 == 1)
statement;

as C treats any non-zero value as true then more succinctly

while (1)
statement;

The idiomatic (C-like) way to do it is

for (;;)
statement;

read your textbook to understand why this works. Even if you
don't like this you must recognise it as you will see it in other
people's code
(*) I bid Algol-60

--
Nick Keighley

"ALGOL 60 was a language so far ahead of its time that it
was not only an improvement on its predecessors but also
on nearly all its successors".
--C.A.R. Hoare

Mar 1 '06 #3

P: n/a
rami said:
please everybody ,can anyone tell me how to do an infinite loop in C


I have written a program for you, that contains an infinite loop, but it
wouldn't be right to show you the code until its test run is complete.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Mar 1 '06 #4

P: n/a
rami wrote:
please everybody ,can anyone tell me how to do an infinite loop in C


I have seen the

while(1)

construct produce warnings with some compilers - 'constant in conditional
expression' or some such thing.

The proper C way is I believe to use

for( ; ; )

that should *not* produce any complaints.
--
==============
Not a pedant
==============
Mar 1 '06 #5

P: n/a

pemo wrote:
rami wrote:
please everybody ,can anyone tell me how to do an infinite loop in C


I have seen the

while(1)

construct produce warnings with some compilers - 'constant in conditional
expression' or some such thing.

The proper C way is I believe to use

for( ; ; )

that should *not* produce any complaints.


IMHO, this is a matter of taste (I prefer `while (1)`). They're both
correct.

I see no reason for either to produce diagnostic messages, although I
could think of a weak rationale for the one you were seeing.

--
BR, Vladimir

Mar 1 '06 #6

P: n/a

rami wrote:
please everybody ,can anyone tell me how to do an infinite loop in C


Pick any of the following:

1. for(;;) {...}
2. while(1) {...}
3. do {...} while(1);

I personally use 1.

Mar 1 '06 #7

P: n/a
Vladimir S. Oka wrote:
pemo wrote:
rami wrote:
please everybody ,can anyone tell me how to do an infinite loop in C


I have seen the

while(1)

construct produce warnings with some compilers - 'constant in
conditional expression' or some such thing.

The proper C way is I believe to use

for( ; ; )

that should *not* produce any complaints.


IMHO, this is a matter of taste (I prefer `while (1)`). They're both
correct.

I see no reason for either to produce diagnostic messages, although I
could think of a weak rationale for the one you were seeing.


I must admit that I haven't seen this warning for quite a while now, but, I
can see why a compiler might see some merit in it, e.g., while(x = 1) might
produce the same output - and, of course, be rather useful.

For those that don't read post too fully - yes, I know that x = 1 should
normally be x == 1 :-)

--
==============
Not a pedant
==============
Mar 1 '06 #8

P: n/a

"pemo" wrote:
Vladimir S. Oka wrote:
pemo wrote:
rami wrote:
please everybody ,can anyone tell me how to do an infinite loop in C

<snip> [while(1) vs. for(;;)]
IMHO, this is a matter of taste (I prefer `while (1)`). They're both
correct.

I see no reason for either to produce diagnostic messages, although I
could think of a weak rationale for the one you were seeing.


I must admit that I haven't seen this warning for quite a while now, but,
I can see why a compiler might see some merit in it, e.g., while(x = 1)
might produce the same output - and, of course, be rather useful.


Yes, that's the rationale for the warning (which can be quite annoying when
porting code from another compiler. But it is better to be warned in a fwe
cases than falling into an endless loop (evenmore on embedded contol
devices, which is OT here, but a huge field where C is used in various
dialects)). The message usually gives something like "conditional expression
in ... is always true".
or "... false", which is annoying when someone is using do{/*code goes
here*/}while(0) to encapsulate a function like macro.

--
regards
John
Mar 1 '06 #9

P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Bode wrote:
rami wrote:
please everybody ,can anyone tell me how to do an infinite loop in C


Pick any of the following:

1. for(;;) {...}
2. while(1) {...}
3. do {...} while(1);


add to that list
4. label: ... goto label;
- --

Lew Pitcher, IT Specialist, Corporate Technology Solutions,
Enterprise Technology Solutions, TD Bank Financial Group

(Opinions expressed here are my own, not my employer's)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEBaTAagVFX4UWr64RAiaiAKDbFvIGUrKGQxe7r4M9eO K8/V4zjgCfc+eb
huRZZhoqn/pUhwWw/IlHSo0=
=mMqY
-----END PGP SIGNATURE-----
Mar 1 '06 #10

P: n/a
Nick Keighley wrote:
rami wrote:
please everybody ,can anyone tell me how to do an infinite loop in C

well the obvious way that applies to pretty well any programming
language
(I'm sure some will take it as a challange to give a counter example
(*)
is to use a while statement.

while (expression)
statement;


Well, some languages, as Oberon, have a special loop statement for
infinite loops and exit-in-the-middle loops:

LOOP
...
IF someCondition THEN EXIT END;
...
END

That way you can clearly express your intention with the loop. Moreover,
in Oberon local exits (break) are only allowed in LOOP statements.

August

--
I am the "ILOVEGNU" signature virus. Just copy me to your
signature. This email was infected under the terms of the GNU
General Public License.
Mar 1 '06 #11

P: n/a
rami wrote:
please everybody ,can anyone tell me how to do an infinite loop in C


I would do

#include <stdbool.h>
....
while (true) { ... }
August

--
I am the "ILOVEGNU" signature virus. Just copy me to your
signature. This email was infected under the terms of the GNU
General Public License.
Mar 1 '06 #12

P: n/a
August Karlstrom wrote:
Nick Keighley wrote:
rami wrote:
please everybody ,can anyone tell me how to do an infinite loop in C


well the obvious way that applies to pretty well any programming
language (I'm sure some will take it as a challange to give a counter example
(*)), is to use a while statement.

while (expression)
statement;


Well, some languages, as Oberon, have a special loop statement for
infinite loops and exit-in-the-middle loops:

LOOP
...
IF someCondition THEN EXIT END;
...
END

That way you can clearly express your intention with the loop. Moreover,
in Oberon local exits (break) are only allowed in LOOP statements.


I'm not sure I'd describe that as the "obvious" way to program an
infinite
loop. But then I've never programmed in Oberon.
--
Nick Keighley

Mar 1 '06 #13

P: n/a
Lew Pitcher wrote:

John Bode wrote:
rami wrote:
please everybody ,can anyone tell me how to do an infinite loop in C


Pick any of the following:

1. for(;;) {...}
2. while(1) {...}
3. do {...} while(1);


add to that list
4. label: ... goto label;


Do not add to the list (unless you're considering an "infinite" computer)
void f(void) { ...; f(); }

--
If you're posting through Google read <http://cfaj.freeshell.org/google>
Mar 1 '06 #14

P: n/a

Nick Keighley wrote:
August Karlstrom wrote:
Nick Keighley wrote:
rami wrote:please everybody ,can anyone tell me how to do an infinite loop in C

well the obvious way that applies to pretty well any programming
language (I'm sure some will take it as a challange to give a counter example
(*)), is to use a while statement.

while (expression)
statement;


Well, some languages, as Oberon, have a special loop statement for
infinite loops and exit-in-the-middle loops:

LOOP
...
IF someCondition THEN EXIT END;
...
END

That way you can clearly express your intention with the loop. Moreover,
in Oberon local exits (break) are only allowed in LOOP statements.


I'm not sure I'd describe that as the "obvious" way to program an
infinite
loop. But then I've never programmed in Oberon.


It's only obvious if the whole loop fits onto one screen. That's also
why I don't consider C construct (to pull this back on-topic)

do
{
/* whatever */;
} while (1);

a very good way to express infinite loops.

If you know in advance it's an infinite loop -- spell it out
immediatelly.

--
BR, Vladimir

Mar 1 '06 #15

P: n/a
John Bode wrote:
rami wrote:
please everybody ,can anyone tell me how to do an infinite loop in C


Pick any of the following:

1. for(;;) {...}
2. while(1) {...}
3. do {...} while(1);

I personally use 1.


Nah. Real programmers use:

meaningfullabel:
....
goto meaningfullabel;

which avoids all that flow of control indentation nonsense. It
also makes that infinite loop accessible from anywhere else in the
function, and encourages creative naming of meaningfullabel.

It is a good idea to present a message within the infinite loop
that says something like:

"Please wait. Calibrating, do not disturb or data will be lost".

If the message terminates with '\r' it may avoid scrolling the
screen or otherwise disturbing the peace of the observer. An
fflush may be needed. Avoid any '\n's.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>
Mar 1 '06 #16

P: n/a
On 2006-03-01, rami <do******@yahoo.com> wrote:
please everybody ,can anyone tell me how to do an infinite loop in C


Our "shop standard" follows Stroustroup and uses for(;;), pronounced
"forever."

Several shops ago, I used while(17) until my boss complained he couldn't
understand it.

Mar 2 '06 #17

P: n/a
Charles Krug said:
On 2006-03-01, rami <do******@yahoo.com> wrote:
please everybody ,can anyone tell me how to do an infinite loop in C


Our "shop standard" follows Stroustroup and uses for(;;), pronounced
"forever."


And does it work?

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Mar 2 '06 #18

P: n/a
Charles Krug wrote:
On 2006-03-01, rami <do******@yahoo.com> wrote:
please everybody ,can anyone tell me how to do an infinite loop
in C


Our "shop standard" follows Stroustroup and uses for(;;),
pronounced "forever."

Several shops ago, I used while(17) until my boss complained he
couldn't understand it.


#define until while
#define the_cows_come_home 17

do {
... stuff ...
} until (the_cows_come_home);

some alternatives (mix and match)

#define hell_freezes_over (1 != 0)
#define no_dog_has_fleas (EOF < 0)

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>
Mar 2 '06 #19

P: n/a
Ico
Richard Heathfield <in*****@invalid.invalid> wrote:
rami said:
please everybody ,can anyone tell me how to do an infinite loop in C


I have written a program for you, that contains an infinite loop, but it
wouldn't be right to show you the code until its test run is complete.


Done yet ?

--
:wq
^X^Cy^K^X^C^C^C^C
Mar 2 '06 #20

P: n/a
Ico said:
Richard Heathfield <in*****@invalid.invalid> wrote:
rami said:
please everybody ,can anyone tell me how to do an infinite loop in C


I have written a program for you, that contains an infinite loop, but it
wouldn't be right to show you the code until its test run is complete.


Done yet ?


Still going strong.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Mar 2 '06 #21

P: n/a
Pedro Graca wrote:
Lew Pitcher wrote:

John Bode wrote:
rami wrote:
please everybody ,can anyone tell me how to do an infinite loop in C

Pick any of the following:

1. for(;;) {...}
2. while(1) {...}
3. do {...} while(1);


add to that list
4. label: ... goto label;


Do not add to the list (unless you're considering an "infinite" computer)
void f(void) { ...; f(); }


inline void f(void) { ...;f(); } ???

or a compiler who knows what means "tail recursion".

Mar 2 '06 #22

P: n/a
On 2006-03-02, CBFalconer <cb********@yahoo.com> wrote:
Charles Krug wrote:
On 2006-03-01, rami <do******@yahoo.com> wrote:
please everybody ,can anyone tell me how to do an infinite loop
in C


Our "shop standard" follows Stroustroup and uses for(;;),
pronounced "forever."

Several shops ago, I used while(17) until my boss complained he
couldn't understand it.


#define until while
#define the_cows_come_home 17

do {
... stuff ...
} until (the_cows_come_home);

some alternatives (mix and match)

#define hell_freezes_over (1 != 0)
#define no_dog_has_fleas (EOF < 0)


Heh. It makes more sense to define them as false statements and define
until(x) as while(!(x)) - since that is the semantics of until in
languages that actually have it.
Mar 2 '06 #23

P: n/a

"CBFalconer" wrote:
Charles Krug wrote:
On 2006-03-01, rami <do******@yahoo.com> wrote:
please everybody ,can anyone tell me how to do an infinite loop
in C


Our "shop standard" follows Stroustroup and uses for(;;),
pronounced "forever."

Several shops ago, I used while(17) until my boss complained he
couldn't understand it.


#define until while
#define the_cows_come_home 17

do {
... stuff ...
} until (the_cows_come_home);

some alternatives (mix and match)

#define hell_freezes_over (1 != 0)
#define no_dog_has_fleas (EOF < 0)


Extraordinarily great idea!!! Had a good laugh...

how about:

#define you_are_old_and_grey (0?(0?0:0):1)
#define you_stop_wondering_about_that_constant 1

:-)

John
Mar 2 '06 #24

P: n/a
"John F" <sp**@127.0.0.1> wrote in message
news:44***********************@tunews.univie.ac.at ...
Extraordinarily great idea!!! Had a good laugh...

how about:

#define you_are_old_and_grey (0?(0?0:0):1)
#define you_stop_wondering_about_that_constant 1


I put off mentioning this one, because I was SURE someone would beat me to it.
Maybe someone did and I didn't catch the message.

I've run across this a number of times:

#define ever ;;

for (ever)
{
/* We're in here forever */
}
Mar 2 '06 #25

P: n/a

"William J. Leary Jr." wrote:
"John F" <sp**@127.0.0.1> wrote:
Extraordinarily great idea!!! Had a good laugh...

how about:

#define you_are_old_and_grey (0?(0?0:0):1)
#define you_stop_wondering_about_that_constant 1


I put off mentioning this one, because I was SURE someone would beat me to
it.
Maybe someone did and I didn't catch the message.

I've run across this a number of times:

#define ever ;;

for (ever)
{
/* We're in here forever */
}


That's great! :-)

--
John
Mar 2 '06 #26

P: n/a
"William J. Leary Jr." <Bi********@msn.com> writes:
"John F" <sp**@127.0.0.1> wrote in message
news:44***********************@tunews.univie.ac.at ...
Extraordinarily great idea!!! Had a good laugh...

how about:

#define you_are_old_and_grey (0?(0?0:0):1)
#define you_stop_wondering_about_that_constant 1


I put off mentioning this one, because I was SURE someone would beat
me to it. Maybe someone did and I didn't catch the message.

I've run across this a number of times:

#define ever ;;

for (ever)
{
/* We're in here forever */
}


I've used that myself, many years ago.

It's very clever. In this context, "clever" is a derogatory term.

I appreciate the humor of cleverly obfuscated code, but if you want an
infinite loop in C code that's intended to be maintained, there are
two common ways to do it:

while (1) { ... }
for (;;) { ... }

There is *no* good reason to use anything else.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Mar 3 '06 #27

P: n/a
William J. Leary Jr. wrote:
#define ever ;;

for (ever)
{
/* We're in here forever */
}


Macros can be a great tool, but they should not be used, in my opinion,
as syntactic sugar. The base syntax of the language should not be
modified in any way if you want your code to be readable. A 'for'
loop without two visible ';' is a syntax mess. Don't do it.

Besides, I try to stick to the convention of declaring macros in all
uppercase. This way, you can see immediately if you are dealing with a
macro.

Preprocessors are handy but dangerous, as they are not really part
of the language itself. Thus you should avoid abstracting its use
at all costs.
Mar 3 '06 #28

P: n/a

"Guillaume" wrote:
William J. Leary Jr. wrote:
#define ever ;;

for (ever)
{
/* We're in here forever */
}
Macros can be a great tool, but they should not be used, in my opinion,
as syntactic sugar. The base syntax of the language should not be
modified in any way if you want your code to be readable. A 'for'
loop without two visible ';' is a syntax mess. Don't do it.


#define ever

for (;ever;)
{
/*code to do*/
}

better?
Besides, I try to stick to the convention of declaring macros in all
uppercase. This way, you can see immediately if you are dealing with a
macro.

Preprocessors are handy but dangerous, as they are not really part
of the language itself. Thus you should avoid abstracting its use
at all costs.


ACK ... It is great for general purpose use but should not be used to "bend"
the language...

--
regards
John
Mar 3 '06 #29

P: n/a
"John F" <sp**@127.0.0.1> writes:
"Guillaume" wrote:
William J. Leary Jr. wrote:
#define ever ;;

for (ever)
{
/* We're in here forever */
}


Macros can be a great tool, but they should not be used, in my opinion,
as syntactic sugar. The base syntax of the language should not be
modified in any way if you want your code to be readable. A 'for'
loop without two visible ';' is a syntax mess. Don't do it.


#define ever

for (;ever;)
{
/*code to do*/
}

better?


No.

If someone reading your code knows C, he knows perfectly well what
"for (;;)" means; he'll have no idea what "ever" means without looking
it up. If he doesn't know C, no amount of preprocessor trickery will
let him understand the code; rather, it will prevent him from learning
good C.

(I don't think you meant to imply that it *is* better, so take this as
an expansion on what you wrote, not a criticism.)

Note that a sufficiently malicious programmer could do something like
this:

#define ever 0

for (;ever;) {
/* this is never executed */
}

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Mar 3 '06 #30

P: n/a

"Keith Thompson" wrote:
"John F" <sp**@127.0.0.1> writes:
"Guillaume" wrote:
William J. Leary Jr. wrote:
#define ever ;;

for (ever)
{
/* We're in here forever */
}
<SNIP>
A 'for'
loop without two visible ';' is a syntax mess. Don't do it.
#define ever

for (;ever;)
{
/*code to do*/
}

better?


No.


I just wanted to be a little bit sarcastic.
If someone reading your code knows C, he knows perfectly well what
"for (;;)" means; he'll have no idea what "ever" means without looking
it up. If he doesn't know C, no amount of preprocessor trickery will
let him understand the code; rather, it will prevent him from learning
good C.
Depends on whether he needs to learn it... Some bosses strictly refuse to
learn anything...
(I don't think you meant to imply that it *is* better, so take this as
an expansion on what you wrote, not a criticism.)
I just wanted to point out, that present ";;" don't necessarily imply
readability/maintainability... It can still be very ambiguous, as you have
pointed out correctly:
Note that a sufficiently malicious programmer could do something like
this:

#define ever 0

for (;ever;) {
/* this is never executed */
}


This would be extremely bad. Indeed. "never" would be a better name
(although the method is generally an abuse of the preprocessor ...)

#define LOOP_NEXT_BLOCK_FOREVER for(;;)

would be just as bad...

I usually do something like

/*infinit loop intentionally*/
for(;;)
{ /*short explaination of the purpose + why infinit*/

/*code goes here*/

}/*~for(;;)*/

all that, just to make things clear for later reading (in case my boss wants
to see what we are doing...)
(I even know people who just wrote for(;;) and intended to fill the missing
parts later on, but then again forgot to do so some lines later... I don't
know how they could get a programmers job, actually)

--
regards
John
Mar 3 '06 #31

P: n/a
John F said:
(I even know people who just wrote for(;;) and intended to fill the
missing parts later on, but then again forgot to do so some lines later...


For the record, my infinite loop program is still going strong (that's two
days now, I think), but the test so far has been inconclusive.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Mar 3 '06 #32

P: n/a

"Richard Heathfield" <in*****@invalid.invalid> wrote in message
news:du**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
-snip

For the record, my infinite loop program is still going strong (that's two
days now, I think), but the test so far has been inconclusive.


Better hope the power doesn't go out!

--
MrG{DRGN}
Mar 3 '06 #33

P: n/a
MrG{DRGN} said:

"Richard Heathfield" <in*****@invalid.invalid> wrote in message
news:du**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
-snip

For the record, my infinite loop program is still going strong (that's
two days now, I think), but the test so far has been inconclusive.


Better hope the power doesn't go out!


Well, that's what UPS is for. It's uninterruptible, right?

The food might run out. The oceans might dry up. The human race might die
out completely. The sun might bloat out into space and consume the earth in
a fiery death. The combined mass of the entire universe might reach its
expansion limit and then coalesce into the mother of all black holes.

But my UPS will still be supplying power to my PC, because that's what
"uninterruptible" means. And my PC must also somehow survive all this,
because it's running an *infinite* loop.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Mar 4 '06 #34

P: n/a
Richard Heathfield ha scritto:

...

Well, that's what UPS is for. It's uninterruptible, right?

The food might run out. The oceans might dry up. The human race might die
out completely. The sun might bloat out into space and consume the earth in
a fiery death. The combined mass of the entire universe might reach its
expansion limit and then coalesce into the mother of all black holes.

But my UPS will still be supplying power to my PC, because that's what
"uninterruptible" means. And my PC must also somehow survive all this,
because it's running an *infinite* loop.


*lol*!
So you solved one of the greatest misteries of the human kind: computers
will survive men, definitely. As there will always be at least one
computer on Earth that is running an infinite loop. Computers will get
their power from us. We will become computers' power suppliers.
Something like Matrix. :)

David

--
Linux Registered User #334216
Get FireFox! >> http://www.spreadfirefox.com/?q=affiliates&id=48183&t=1
Staff >> http://www.debianizzati.org <<
Mar 4 '06 #35

P: n/a
Richard Heathfield wrote:
John F said:
(I even know people who just wrote for(;;) and intended to fill the
missing parts later on, but then again forgot to do so some lines later...


For the record, my infinite loop program is still going strong (that's two
days now, I think), but the test so far has been inconclusive.


Now if you can just arrange to extract a few ergs net from each
pass, we could be well on the way to energy independence.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>
Mar 4 '06 #36

P: n/a
Richard Heathfield wrote:
MrG{DRGN} said:
"Richard Heathfield" <in*****@invalid.invalid> wrote in message
news:du**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
-snip
For the record, my infinite loop program is still going strong (that's
two days now, I think), but the test so far has been inconclusive.

Better hope the power doesn't go out!


Well, that's what UPS is for. It's uninterruptible, right?

The food might run out. The oceans might dry up. The human race might die
out completely. The sun might bloat out into space and consume the earth in
a fiery death. The combined mass of the entire universe might reach its
expansion limit and then coalesce into the mother of all black holes.

But my UPS will still be supplying power to my PC, because that's what
"uninterruptible" means. And my PC must also somehow survive all this,
because it's running an *infinite* loop.


That was great! I needed that laugh...Thank you!

--
Sean
Mar 10 '06 #37

P: n/a
On Wed, 1 Mar 2006 09:03:42 +0000 (UTC),
Richard Heathfield <in*****@invalid.invalidwrote:
rami said:
>please everybody ,can anyone tell me how to do an infinite loop in C

I have written a program for you, that contains an infinite loop, but it
wouldn't be right to show you the code until its test run is complete.
Richard,

I'd be very interested to see that code too, so... what's the status? Is
it anywhere near infinity yet?

Many thanks in advance.

--
mwo, Researcher

Jul 16 '06 #38

P: n/a
Man with Oscilloscope said:

<snip>
>
I'd be very interested to see that code too, so... what's the status? Is
it anywhere near infinity yet?
137 days later... it's still going strong, but there's some way to go yet.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Jul 16 '06 #39

P: n/a
Richard Heathfield <in*****@invalid.invalidwrites:
Man with Oscilloscope said:

<snip>
>>
I'd be very interested to see that code too, so... what's the status? Is
it anywhere near infinity yet?

137 days later... it's still going strong, but there's some way to go yet.
"Are we there yet?"

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Jul 16 '06 #40

P: n/a
Man with Oscilloscope wrote:
On Wed, 1 Mar 2006 09:03:42 +0000 (UTC),
Richard Heathfield <in*****@invalid.invalidwrote:
>rami said:
>>please everybody ,can anyone tell me how to do an infinite loop in C
I have written a program for you, that contains an infinite loop, but it
wouldn't be right to show you the code until its test run is complete.
I'd be very interested to see that code too, so... what's the status? Is
it anywhere near infinity yet?

Many thanks in advance.
[Sarcastic example I came up with removed.]

<http://www.google.com/search?hl=en&sa=X&oi=spell&resnum=0&ct=result&cd=1 &q=C+language+infinite+loop>
Jul 17 '06 #41

P: n/a
Keith Thompson wrote:
Richard Heathfield <in*****@invalid.invalidwrites:
>>Man with Oscilloscope said:

<snip>
>>>I'd be very interested to see that code too, so... what's the status? Is
it anywhere near infinity yet?

137 days later... it's still going strong, but there's some way to go yet.


"Are we there yet?"
Maybe you could send me the code in a private message for testing. I've
got a machine here that does the infinite loop in a couple of hours.
-- Mark.
Jul 18 '06 #42

P: n/a
U
On Wed, 1 Mar 2006 09:03:42 +0000 (UTC), in comp.lang.c,
msgid:<8f********************@bt.com>, Richard Heathfield wrote:
rami said:
>please everybody ,can anyone tell me how to do an infinite loop in C

I have written a program for you, that contains an infinite loop, but it
wouldn't be right to show you the code until its test run is complete.
I'm almost afraid to ask... what's the progress?

Regards,
U

--
U
Pre-ANSI C User Group, Ur, Mesopotamia, founding member
email: U@foo.example.net

Dec 19 '06 #43

P: n/a
U <U@foo.example.netwrites:
On Wed, 1 Mar 2006 09:03:42 +0000 (UTC), in comp.lang.c,
msgid:<8f********************@bt.com>, Richard Heathfield wrote:
>rami said:
>>please everybody ,can anyone tell me how to do an infinite loop in C

I have written a program for you, that contains an infinite loop, but it
wouldn't be right to show you the code until its test run is complete.

I'm almost afraid to ask... what's the progress?

Regards,
U
U! It's you! Where have u been?

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Dec 19 '06 #44

P: n/a
Keith Thompson wrote:
U <U@foo.example.netwrites:
>On Wed, 1 Mar 2006 09:03:42 +0000 (UTC), in comp.lang.c,
msgid:<8f********************@bt.com>, Richard Heathfield wrote:
>>rami said:

please everybody ,can anyone tell me how to do an infinite loop in C

I have written a program for you, that contains an infinite loop, but it
wouldn't be right to show you the code until its test run is complete.

I'm almost afraid to ask... what's the progress?

Regards,
U

U! It's you! Where have u been?
We can now leave all requests like "can u help me ..." to U. That
should reduce the load.

Hmm. Can we find some idiot\\\\\public benefactor to participate here
under the name "You"?

--
Chris "HO. HO. HO." Dollin
"A facility for quotation covers the absence of original thought." /Gaudy Night/

Dec 19 '06 #45

P: n/a
Chris Dollin wrote:
>
Keith Thompson wrote:
U <U@foo.example.netwrites:
Regards,
U
U! It's you! Where have u been?

We can now leave all requests like "can u help me ..." to U. That
should reduce the load.

Hmm. Can we find some idiot\\\\\public benefactor to participate here
under the name "You"?
I used to know a Korean named Yu, and a Chinese guy named Hu.
But I knew them at different times in different places
so I was never able to introduce them to each other: "Hu, Yu. Yu, Hu."

--
pete
Dec 19 '06 #46

P: n/a
U said:
On Wed, 1 Mar 2006 09:03:42 +0000 (UTC), in comp.lang.c,
msgid:<8f********************@bt.com>, Richard Heathfield wrote:
>rami said:
>>please everybody ,can anyone tell me how to do an infinite loop in C

I have written a program for you, that contains an infinite loop, but it
wouldn't be right to show you the code until its test run is complete.

I'm almost afraid to ask... what's the progress?
In absolute terms, it's extremely encouraging - the loop is proceeding very,
very quickly. But there's a long way to go yet.
Regards,
U
How was your holiday?

(Make sure you're sitting down before you look at the size of your in-tray.)

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Dec 19 '06 #47

P: n/a
Richard Heathfield wrote:
rami said:
>please everybody ,can anyone tell me how to do an infinite loop in C

I have written a program for you, that contains an infinite loop, but it
wouldn't be right to show you the code until its test run is complete.
This thing still running?

Dec 14 '07 #48

P: n/a
Franz Hose said:
Richard Heathfield wrote:
>rami said:
>>please everybody ,can anyone tell me how to do an infinite loop in C

I have written a program for you, that contains an infinite loop, but it
wouldn't be right to show you the code until its test run is complete.
This thing still running?
Yes, although for a week or two it slowed almost to a crawl (the machine
was very busy doing some heavy prime calcs) - but it soon picked up again
afterwards.

I've had to be pretty firm about this program - I've had no fewer than
three (rather generous) offers for exclusive rights to the source code,
one of them from someone in the States who called himself "Mr G", but I
cannot in all conscience release the code, even commercially, until the
test is complete.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Dec 15 '07 #49

P: n/a
In article <bI*********************@bt.com>,
Richard Heathfield <rj*@see.sig.invalidwrote:
>I've had to be pretty firm about this program - I've had no fewer than
three (rather generous) offers for exclusive rights to the source code,
one of them from someone in the States who called himself "Mr G", but I
cannot in all conscience release the code, even commercially, until the
test is complete.
I don't think you need worry. Unless they have *very* fast computers,
their copy won't terminate before yours.

-- Richard
--
:wq
Dec 15 '07 #50

59 Replies

This discussion thread is closed

Replies have been disabled for this discussion.