Need experts suggestion

E

Eric Sosman

Richard said:
Gsec said:




I have had an infinite loop under test since the beginning of March. So far,
we're looking good - but it's early days yet.

Quantum computers are predicted to be fast enough to
complete an infinite loop in less than an attosecond, and
they should become available at about the same time your
loop on conventional hardware finishes.
 
G

Gsec

I guess, TOPIC HEADER doesn't include you !! Ok, thanks again for the
valuable informations!
Now I prefer to wait more ! ( haha, I didn't mean that I will throw my
PC in MOON and wait for it to
fall on the ground infront of my house, and crash !;-)

-gsec
 
C

CBFalconer

Richard said:
Gsec said:

I have had an infinite loop under test since the beginning of
March. So far, we're looking good - but it's early days yet.

When do you project you will have 90% confidence in the code? Will
you then publish it? Assuming no test failures, of course. How
have you arranged to ignore hardware failures?

--
"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/>
 
V

Vladimir Oka

Richard said:
I have a computer at home that will crash after about five minutes of
running that program.

What's wrong with it -- your computer, I mean.

It's Friday afternoon 'round here, and I just left my office PC running
the above. I'll report how it fares on Tuesday (Monday's a public
holiday -- hooray!).
 
C

CBFalconer

Gsec said:
Thanks. Sorry that my question was not that clear before. Well let me
make the picture very clear. My question is from Stack overflow point
of view.If you write an infinite loop simply, it will crash after some
time. Similarly, if we call main() within main (),
it will crash after some time definitely due to stack overflow !

So, I think that the buffer overflow method will let me my program to
execute on an infinite way, with no SIGSEGV.

I hope, now you can let me know more information on my query.

In general on usenet you should realize that readers may very well
not have convenient access to previous articles in a thread. That
means that your reply articles should include adequate context, so
that they stand by themselves. Google is NOT usenet, it is only a
very poor interface to the real usenet system. To include proper
context when using google, see my sig. below. Please be sure to
read the referenced URLs.

--
"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/>
 
R

Richard Heathfield

CBFalconer said:
When do you project you will have 90% confidence in the code?

When the loop is 90% complete.
Will you then publish it?

If God spares me until then, yes, sure.
Assuming no test failures, of course. How
have you arranged to ignore hardware failures?

If the hardware fails, the loop should nevertheless keep going; if not, the
test fails.
 
T

Tomás

Gsec posted:
Hi,

Can anybody let me know how to write a infinite loop, such that the
program never crashes ?


int main(void)
{
for(;;)
{
/* Repetitive actions go in here */
}
}


You won't get a stack overflow unless you recursively call a function:

void SomeFunc(void)
{
double array[50];

SomeFunc();
}

int main(void)
{
SomeFunc();
}


But you WON'T get a stack overflow if you simply call a function in a
loop:

void SomeFunc(void)
{
double array[50];
}

int main(void)
{
for (;;)
{
SomeFunc();
}
}


Or if you want to be hardcore:


int main(boid)
{
Start_Loop:

/* Repetitive Actions Here */

goto Start_Loop;
}


-Tomás
 
D

Default User

Gsec said:
Hi,

Can anybody let me know how to write a infinite loop, such that the
program never crashes ?


My recommendation is that you learn the C language and stop wasting
time with this sort of nonsense.




Brian
 
K

Keith Thompson

Gsec said:
I guess, TOPIC HEADER doesn't include you !! Ok, thanks again for the
valuable informations!
Now I prefer to wait more ! ( haha, I didn't mean that I will throw my
PC in MOON and wait for it to
fall on the ground infront of my house, and crash !;-)

You'll find that insulting people who are trying to help you is not a
good way to get them to continue trying to help you.

Your original question is extremely unclear, and your followups did
not clarify it. As stated, there are a number of trivial solutions,
such as:

int main(void) { while (1); }

It's an infinite loop, and if it ever crashes it will be for reasons
having nothing to do with the program itself. There is no better
solution to your problem *as stated*.

I suspect that what you mean by "infinite loop" isn't the same as what
the rest of us mean by it. "while (1);" is an infinite loop. If you
believe it isn't, you're misusing the term, and you need to explain to
us what you actually mean.

Does the body of the "infinite loop" need to do something useful, or
is the goal just to create an "infinite loop"?

Presumably this isn't an end in itself, but a means to some end.
Telling us what you're actually trying to accomplish might help us to
figure out just what your question means.

Or show us some code, or even pseudo-code if necessary, and tell us
how it fails to meet your requirements.

I suspect that your actual problem is either trivial, insoluble in
general, or insoluble without using system-specific extensions. But
I'm only guessing.

You might also want to read
<http://clc-wiki.net/wiki/Introduction_to_comp.lang.c>.
 
P

pete

Keith said:
You'll find that insulting people who are trying to help you is not a
good way to get them to continue trying to help you.
I suspect that what you mean by "infinite loop" isn't the same as what
the rest of us mean by it.

That's not the case.
Vladimir Oka showed three loops to Gsec,
and Gsec dismissed them:

"Thanks;-). But, I don't think, any one will do. Try it first, then if
it doesn't crash after one week (;-) ), let me know !;-)"

http://groups.google.com/group/comp.lang.c/msg/73cd5458803e6242
 
A

Artie Gold

Richard said:
I have a computer at home that will crash after about five minutes of
running that program.

-- Richard
Yeah, I had one like that once....

--ag
 
M

Malcolm

Gsec said:
Hi,

Can anybody let me know how to write a infinite loop, such that the
program never crashes ?

I, guess, buffer overflow method mite help!Not sure.

Plz let me know.

-thanks and regards,
You can get C compilers which define all instances of behaviour undefined by
the standard. Such programs will never "crash".
Unfortunately this gains you only a little. If a program is incorrect, what
do you want it to do?

Is there a way of proving programs are correct? For practical purposes, no.
You can use structured methods to reduce the chance of error, but they don't
provide a formal proof of correctness. There are I think mathematically
rigorous formal ways of proving algorithm correctness, but they can be used
only by experts.
 
P

pete

Malcolm wrote:
Is there a way of proving programs are correct?
For practical purposes, no.
You can use structured methods to reduce the chance of error,
but they don't
provide a formal proof of correctness.

I disagree.
"correct program" is a technical term in C
and it's unrelated to formal proofs of correctness.
A correct program, is a program without undefined behavior.

C99
4. Conformance
1 In this International Standard, ‘‘shall’’
is to be interpreted as a requirement on an
implementation or on a program; conversely,
‘‘shall not’’ is to be interpreted as a prohibition.

2 If a ‘‘shall’’ or ‘‘shall not’’ requirement
that appears outside of a constraint is violated,
the behavior is undefined.
Undefined behavior is otherwise indicated in this International
Standard by the words ‘‘undefined behavior’’
or by the omission of any explicit definition of behavior.
There is no difference in emphasis among these three;
they all describe ‘‘behavior that is undefined’’.

3 A program that is correct in all other aspects,
operating on correct data,
containing unspecified behavior shall be
a correct program
and act in accordance with 5.1.2.3.
 
M

Mark McIntyre

Hi Pemb,

Thanks. Sorry that my question was not that clear before. Well let me
make the picture very clear. My question is from Stack overflow point
of view.If you write an infinite loop simply, it will crash after some
time. Similarly, if we call main() within main (),
it will crash after some time definitely due to stack overflow !

Thats not a loop, thats recursion. Infinite recursion is impossible
without infinite memory.
So, I think that the buffer overflow method will let me my program to
execute on an infinite way, with no SIGSEGV.

I don't know what on earth you mean by "buffer overflow method". If
you overflow a buffer, your programme may crash, work, or damage other
programmes or systems. This isn't a method.
I hope, now you can let me know more information on my query.

Explan what you are really trying to do, not what you think you need,
in order to achieve it.

If you want to climb a tall building, ask how to climb tall buildings,
don't ask whether nylon or hemp makes better ropes.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
J

Joe Wright

Gsec said:
Hi Pemb,

Thanks. Sorry that my question was not that clear before. Well let me
make the picture very clear. My question is from Stack overflow point
of view.If you write an infinite loop simply, it will crash after some
time. Similarly, if we call main() within main (),
it will crash after some time definitely due to stack overflow !

So, I think that the buffer overflow method will let me my program to
execute on an infinite way, with no SIGSEGV.

I hope, now you can let me know more information on my query.

Thanks.

Gsec
No. Loops don't use a stack. 'for (;;);' will run happily until your
alzheimers kicks in and you forget to pay the electrics.
 
A

Andrew Poelstra

You can get C compilers which define all instances of behaviour undefined by
the standard. Such programs will never "crash".
Unfortunately this gains you only a little. If a program is incorrect, what
do you want it to do?
I'd personally want it to crash.
Is there a way of proving programs are correct? For practical purposes, no.
You can use structured methods to reduce the chance of error, but they don't
provide a formal proof of correctness. There are I think mathematically
rigorous formal ways of proving algorithm correctness, but they can be used
only by experts.

Not really; most algorithms can be proved by induction, and the actual code
is almost always scarier than the algorithm, in my experience.
 
M

Malcolm

Andrew Poelstra said:
Not really; most algorithms can be proved by induction, and the actual
code
is almost always scarier than the algorithm, in my experience.
Lets say we've got a non-trivial problem, such as writing a C compiler.
There are methods you can go through to try to produce a correct program. We
can't surrender the word "correct" to a committee that can't even come up
with a usable standard. Many correct C compilers are in fact written.
However to actually prove that the compiler will work correctly on all input
is a very difficult thing to do. There are in fact no official test suites,
because no one has managed to devise one that ensures compliance.
 
G

Gsec

Keith said:
You'll find that insulting people who are trying to help you is not a
good way to get them to continue trying to help you.
Hi ,

I , by no way, meant insulting you people in my message. Anyway, what I
meant is that it is always impossible to know everything for anybody !
But, some peoples' reply was very tedious and insulting to me as well !
I also admit that my question was not clear in one of my mesg ! But,
the kind and attitude of the reply I recieved was not acceptible at all
(because, there are definitely be more expert people who are , at the
same time very very humble along wth their expertization in their
fields! )

Also, my aim was not to insult ALL people like you, who are decent ,
and I mistakenly sent that message to the whole group ! Very sorry for
that !

Thanks again for the reply. I was wrong with my question. Again, lets
not waste your time on saying sorry , meantime you could have given one
more good reply to novice like me ;-) !

Bestest regards,

Gsec
 
V

Vladimir Oka

Vladimir said:
What's wrong with it -- your computer, I mean.

It's Friday afternoon 'round here, and I just left my office PC running
the above. I'll report how it fares on Tuesday (Monday's a public
holiday -- hooray!).

Back at work, and look! It's still going strong (90 hours and
counting). ;-)

Killed it now, mostly to help reduce global warming.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top