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,
Gsec 68 3114
Gsec wrote: Hi,
Can anybody let me know how to write a infinite loop, such that the program never crashes ?
Pick your poison:
for ( ; ; ) { /* whatever */ }
while ( 1 ) { /* whatever */ }
do { /* whatever */ } while ( 1 );
inf_label:
/* whatever */
goto inf_label;
Of course you have to make sure that { /* whatever */ } does not
crash.
I, guess, buffer overflow method mite help!Not sure.
I don't know what buffer overflow has to do with infinte loop. I'm even
more baffled by mites.
Plz let me know.
Oh, sorry. I didn't realise you wanted Plz to help you. Oh, well...
Hi,
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 !;-)
gsec
Vladimir Oka wrote: Gsec wrote: Hi,
Can anybody let me know how to write a infinite loop, such that the program never crashes ?
Pick your poison:
for ( ; ; ) { /* whatever */ } while ( 1 ) { /* whatever */ } do { /* whatever */ } while ( 1 );
inf_label: /* whatever */ goto inf_label;
Of course you have to make sure that { /* whatever */ } does not crash.
I, guess, buffer overflow method mite help!Not sure.
I don't know what buffer overflow has to do with infinte loop. I'm even more baffled by mites.
Plz let me know.
Oh, sorry. I didn't realise you wanted Plz to help you. Oh, well...
"Gsec" <Ga***********@gmail.com> wrote in message
news:11**********************@j55g2000cwa.googlegr oups.com... 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.
I take it that you want to insert code in the infinite loop? And, you'd
like the unmentioned code to recover from whatever fault may be generated?
I'm supposing that is you intended to ask...
If so, you need to look at:
1) setjmp(), jmpto() and jmpbuf[] to restore as much as possible of the
pre-fault execution context
2) signal() for turning off signals, by setting SIGBREAK (or SIGQUIT),
SIGINT, and SIGABRT to SIG_IGN
3) turning off any Ctrl-C or Ctrl-break handling, using some non-standard
function, like setcbrk() or break_off()
Rod Pemberton
Gsec wrote: Hi,
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 !;-)
gsec Vladimir Oka wrote: Gsec wrote: Hi,
Can anybody let me know how to write a infinite loop, such that the program never crashes ?
Pick your poison:
for ( ; ; ) { /* whatever */ } while ( 1 ) { /* whatever */ } do { /* whatever */ } while ( 1 );
inf_label: /* whatever */ goto inf_label;
Of course you have to make sure that { /* whatever */ } does not crash.
I, guess, buffer overflow method mite help!Not sure.
I don't know what buffer overflow has to do with infinte loop.
Buffer overflow has nothing to do with infinte loop,
as I'm sure you know.
OP is acting the clown.
--
pete
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
Vladimir Oka said: I'm even more baffled by mites.
There are powders you can get...
--
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)
Gsec wrote: 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.
The C langauge does not define stacks.
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 !
I think you're confusing a recursive function call from an infinite
loop. The former will likely crash after sometime while the latter
should not.
So, I think that the buffer overflow method will let me my program to execute on an infinite way, with no SIGSEGV.
Buffer overflow has nothing to do with infinite loops.
Gsec said: Hi,
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 !;-)
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.
--
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)
Gsec said: So, I think that the buffer overflow method will let me my program to execute on an infinite way, with no SIGSEGV.
It's more likely to have the opposite effect. The way to avoid segfaults in
your program is to write the code properly.
--
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)
Gsec wrote: 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.
What makes you think `while (1) {}` will ever crash?
Similarly, if we call main() within main (), it will crash after some time definitely due to stack overflow !
You think so?
int main(void) { return main(); }
need not crash.
<fx:codingHappens/>
Make that "does not crash".
So, I think that the buffer overflow method will let me my program to execute on an infinite way, with no SIGSEGV.
I have this feeling you're not asking the question you mean to ask.
--
Chris "gcc -O4 main.c; ./a.out" Dollin
"We did not have time to find out everything we wanted to know." /A Clash of Cymbals/
Gsec wrote: Vladimir Oka wrote: Gsec wrote: Hi,
Can anybody let me know how to write a infinite loop, such that the program never crashes ?
Pick your poison:
for ( ; ; ) { /* whatever */ } while ( 1 ) { /* whatever */ } do { /* whatever */ } while ( 1 );
inf_label: /* whatever */ goto inf_label;
Of course you have to make sure that { /* whatever */ } does not crash.
I, guess, buffer overflow method mite help!Not sure.
I don't know what buffer overflow has to do with infinte loop. I'm even more baffled by mites.
Plz let me know.
Oh, sorry. I didn't realise you wanted Plz to help you. Oh, well... Hi,
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 !;-)
Don't top post. I've fixed it here.
Why would those infinite loops crash? Please explain.
I'm sure that this:
int main(void)
{
for ( ; ; )
;
}
has no reason whatsoever to crash. Your PC may crash for other reasons
(say, if you drop it on the floor), but not because of anythingin the
program above.
Richard Heathfield wrote: Vladimir Oka said:
I'm even more baffled by mites.
There are powders you can get...
Baffled, not infested. ;-)
OP might be though. He may be scratching so much that he knock his PC
to the floor, where it then crashes and stops his infinite loops.
Gsec wrote: 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.
It won't.
I hope, now you can let me know more information on my query.
You're wrong.
--
pete
Vladimir Oka wrote: Gsec wrote: Gsec wrote: Hi,
Can anybody let me know how to write a infinite loop, such that the program never crashes ?
.... snip ... 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 !;-)
Don't top post. I've fixed it here.
Why would those infinite loops crash? Please explain.
I think the OP is confusing the difference between a simple infinite
loop and infinitly recursive function calls. The latter would probably
crash. Amazingly, he seems to believe precipitating a buffer overflow
will prevent such a crash.
This is the result of reading cheap books whose titles usually begin
with "Hacking ..."
On 2006-05-26, Richard Heathfield <in*****@invalid.invalid> wrote: Gsec said:
Hi,
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 !;-)
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.
Isn't it always?
pete wrote: Richard Heathfield wrote: Vladimir Oka said:
I'm even more baffled by mites.
There are powders you can get...
There's also mites you can buy, that eat other mites.
http://www.zone10.com/tech/mites/mites_gb.htm
LoL. I loved the section named "Arrival and Deployment of your troops".
;-)
In article <11**********************@i40g2000cwc.googlegroups .com>,
Vladimir Oka <no****@btopenworld.com> wrote: I'm sure that this:
int main(void) { for ( ; ; ) ; }
has no reason whatsoever to crash. Your PC may crash for other reasons (say, if you drop it on the floor), but not because of anythingin the program above.
I have a computer at home that will crash after about five minutes of
running that program.
-- Richard
Richard Tobin wrote: In article <11**********************@i40g2000cwc.googlegroups .com>, Vladimir Oka <no****@btopenworld.com> wrote:I'm sure that this:
int main(void) { for ( ; ; ) ; }
I have a computer at home that will crash after about five minutes of running that program.
Why do you think that happens?
Does it overheat?
I've worked with computers that were inadequately ventilated,
that crashed after several hours,
but not always the same amount of hours.
The programmers couldn't figure that one out.
They had to get the company "smart guy" to figure that one out.
--
pete
Richard Heathfield wrote: Gsec said:
Hi,
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 !;-)
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.
--
Eric Sosman es*****@acm-dot-org.invalid
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
Richard Heathfield wrote: Gsec said:
Hi,
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 !;-)
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.
Ship it!
--
==============
Not a pedant
==============
Richard Tobin wrote: In article <11**********************@i40g2000cwc.googlegroups .com>, Vladimir Oka <no****@btopenworld.com> wrote:I'm sure that this:
int main(void) { for ( ; ; ) ; }
has no reason whatsoever to crash. Your PC may crash for other reasons (say, if you drop it on the floor), but not because of anythingin the program above.
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!).
Richard Heathfield wrote: Gsec said: 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 !;-)
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/>
Gsec wrote: 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/>
CBFalconer said: Richard Heathfield wrote: Gsec said: 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 !;-) 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?
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.
--
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)
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
Gsec wrote: 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
"Gsec" <Ga***********@gmail.com> writes: 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>.
--
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.
Keith Thompson wrote: "Gsec" <Ga***********@gmail.com> writes: 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.
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....cd5458803e6242
--
pete
Richard Tobin wrote: In article <11**********************@i40g2000cwc.googlegroups .com>, Vladimir Oka <no****@btopenworld.com> wrote:
I'm sure that this:
int main(void) { for ( ; ; ) ; }
has no reason whatsoever to crash. Your PC may crash for other reasons (say, if you drop it on the floor), but not because of anythingin the program above.
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
--
Artie Gold -- Austin, Texas http://goldsays.blogspot.com
"You can't KISS* unless you MISS**"
[*-Keep it simple, stupid. **-Make it simple, stupid.]
"Gsec" <Ga***********@gmail.com> wrote 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.
--
Buy my book 12 Common Atheist Arguments (refuted)
$1.25 download or $7.20 paper, available www.lulu.com/bgy1mm
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.
--
pete
On 26 May 2006 03:38:02 -0700, in comp.lang.c , "Gsec"
<Ga***********@gmail.com> wrote: 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
Gsec wrote: 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.
--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
On 2006-05-27, Malcolm <re*******@btinternet.com> wrote: "Gsec" <Ga***********@gmail.com> wrote 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?
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.
--
Andrew Poelstra < http://www.wpsoftware.net/blog >
To email me, use "apoelstra" at the above address.
It's just like stealing teeth from a baby.
"Andrew Poelstra" <ap*******@localhost.localdomain> 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. 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.
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.
--
Buy my book 12 Common Atheist Arguments (refuted)
$1.25 download or $7.20 paper, available www.lulu.com/bgy1mm
Keith Thompson wrote: "Gsec" <Ga***********@gmail.com> writes: 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.
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
Vladimir Oka wrote: Richard Tobin wrote: In article <11**********************@i40g2000cwc.googlegroups .com>, Vladimir Oka <no****@btopenworld.com> wrote:I'm sure that this:
int main(void) { for ( ; ; ) ; }
has no reason whatsoever to crash. Your PC may crash for other reasons (say, if you drop it on the floor), but not because of anythingin the program above.
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!).
Back at work, and look! It's still going strong (90 hours and
counting). ;-)
Killed it now, mostly to help reduce global warming.
pete wrote: C99 4. Conformance ... 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’’.
I can only refer to n1124, but I think you seriously misquoted the last
clause. It reads there:
they all describe "behavior that is undefined".
The quotation marks make a crucial difference. Without them, the verb
'describe' relates to 'behavior', and that behavior be undefined. This
is nonsense: behavior which is described is not undefined. With the
correct quotation, the verb 'describe' relates to the phrase 'behavior
that is undefined’’'. Thus, there is no description of behavior, but
merely a description of that phrase.
Failure to differentiate between these often leads to ridiculous
statements like "code invokes undefined behavior". Behavior which is
invoked is defined *de facto* by the result of its very invocation. It
would be acceptable to say "code has undefined behavior", which just
means "the behavior of the code is not defined by the International
Standard".
Undefined behavior, by the way, does also not mean "anything can
happen". Even if the International Standard does not forbid a certain
event, there are still other authorities, such as the laws of physics. I
get a headache every time I read about those (in)famous 'nasal demons'.
Yet, one might say that this headache is caused just by those demons
waiting to fly out of my nose.
--
Dietmar
Dietmar Schindler wrote: pete wrote:
they all describe ‘‘behavior that is undefined’’.
they all describe "behavior that is undefined".
The quotation marks make a crucial difference.
That's the way my copy and paste, works with pdf files.
--
pete
"Dietmar Schindler" <dS***@arcor.de> wrote It would be acceptable to say "code has undefined behavior", which just means "the behavior of the code is not defined by the International Standard".
Exactly. Implementations can and do define a null pointer dereference to
print out a message such as "segmentation fault". Undefined behavior, by the way, does also not mean "anything can happen". Even if the International Standard does not forbid a certain event, there are still other authorities, such as the laws of physics. I get a headache every time I read about those (in)famous 'nasal demons'. Yet, one might say that this headache is caused just by those demons waiting to fly out of my nose.
This is what I all the Shakespearian monkey fallacy. It claims that if you
have a sufficiently large number of monkeys with typewriters, you will
eventually produce the works of Shakespeare.
Humans who buy lottery tickets with million dollar headline prizes are
committing the same fallacy. We are simply not wired to believe that random
events do not produce humanly-meaningful results more often than chance. In
particular, corrupting a computer's memory with random garbage is extremely
unlikely to produce anything other than a crash, not nasal demons or little
elves on screen.
--
Buy my book 12 Common Atheist Arguments (refuted)
$1.25 download or $7.20 paper, available www.lulu.com/bgy1mm
"Malcolm" <re*******@btinternet.com> writes: "Dietmar Schindler" <dS***@arcor.de> wrote It would be acceptable to say "code has undefined behavior", which just means "the behavior of the code is not defined by the International Standard". Exactly. Implementations can and do define a null pointer dereference to print out a message such as "segmentation fault".
Sure, but attempting to dereference a pointer with a garbage value
won't necessarily cause a segmentation fault. It might just happen to
point to valid data (just not the data it's supposed to point to). Undefined behavior, by the way, does also not mean "anything can happen". Even if the International Standard does not forbid a certain event, there are still other authorities, such as the laws of physics. I get a headache every time I read about those (in)famous 'nasal demons'. Yet, one might say that this headache is caused just by those demons waiting to fly out of my nose. This is what I all the Shakespearian monkey fallacy. It claims that if you have a sufficiently large number of monkeys with typewriters, you will eventually produce the works of Shakespeare. Humans who buy lottery tickets with million dollar headline prizes are committing the same fallacy. We are simply not wired to believe that random events do not produce humanly-meaningful results more often than chance. In particular, corrupting a computer's memory with random garbage is extremely unlikely to produce anything other than a crash, not nasal demons or little elves on screen.
Events that cause undefined behavior are seldom truly random. If
software runs in a *malicious* environment, a coding error that causes
undefined behavior will very likely be exploited to cause results far
worse than a simple crash (worms, viruses, etc.).
Some time ago, my laptop's hard drive failed badly enough that it had
to be replaced. I don't know what caused it, but it's entirely
possible that it was the result of undefined behavior in some piece of
C code.
And some people do win millions of dollars in lotteries.
--
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.
Dietmar Schindler wrote: [...] Undefined behavior, by the way, does also not mean "anything can happen". Even if the International Standard does not forbid a certain event, there are still other authorities, such as the laws of physics. I get a headache every time I read about those (in)famous 'nasal demons'. Yet, one might say that this headache is caused just by those demons waiting to fly out of my nose.
"Anything can happen" is, as you point out, something of
an overstatement. Perhaps "Nothing is forbidden to happen"
might be a better way of describing undefined behavior.
As for the demons: Once upon a time when the ANSI Standard
was new, posters to comp.lang.c took some delight in coming up
with inventive and amusing descriptions of "unforbidden" behavior.
They began with (relatively) plausible things like "Dereferencing
a null pointer will burn a hole in your monitor" (a reference to
something that, I'm told, could actually happen with some early
PCs), or "fflush(stdin) will reformat your hard drive." It
didn't take long for the descriptions to become more fanciful:
"Shift by a negative bit count and chocolate pudding will ooze
from your floppy drive" or "Try to reference free()d memory and
your computer's too too solid silicon will melt, thaw, and resolve
itself into a dew."
Eventually (and quite suddenly, for some reason), "Demons
will fly out of your nose" became the canonical description of
all undefined behavior. There's nothing particularly special
about these demons, except that they seem to have put an abrupt
end to the same stream of whimsical inventiveness that engendered
them. If they give you headaches, perhaps you can obtain relief
by reopening the long-shuttered windows of creativity and letting
some other U.B. descriptions take to the air for a while.
It'd be more fun to read amusing U.B. descriptions than to
read endless broadsides against Googlers.
--
Eric Sosman es*****@acm-dot-org.invalid
On Sat, 3 Jun 2006 10:22:34 +0100, "Malcolm"
<re*******@btinternet.com> wrote: Undefined behavior, by the way, does also not mean "anything can happen". Even if the International Standard does not forbid a certain event, there are still other authorities, such as the laws of physics. I get a headache every time I read about those (in)famous 'nasal demons'. Yet, one might say that this headache is caused just by those demons waiting to fly out of my nose. This is what I all the Shakespearian monkey fallacy.
Oh? I always called it a joke.
I *really* don't think that users of the phrase mean it to be taken
literally.
--
Al Balmer
Sun City, AZ
Al Balmer wrote: "Malcolm" <re*******@btinternet.com> wrote:
.... snip ... Undefined behavior, by the way, does also not mean "anything can happen". Even if the International Standard does not forbid a certain event, there are still other authorities, such as the laws of physics. I get a headache every time I read about those (in)famous 'nasal demons'. Yet, one might say that this headache is caused just by those demons waiting to fly out of my nose.
This is what I all the Shakespearian monkey fallacy.
Oh? I always called it a joke.
I *really* don't think that users of the phrase mean it to be taken literally.
We have told you at least a billion times, always exagerate the
effects of UB.
BTW, you snipped the attributions of quoted material. Please don't.
--
Some informative links:
news:news.announce.newusers http://www.geocities.com/nnqweb/ http://www.catb.org/~esr/faqs/smart-questions.html http://www.caliburn.nl/topposting.html http://www.netmeister.org/news/learn2quote.html
On Sun, 04 Jun 2006 07:38:28 -0400, CBFalconer <cb********@yahoo.com>
wrote: Al Balmer wrote: "Malcolm" <re*******@btinternet.com> wrote: ... snip ... Undefined behavior, by the way, does also not mean "anything can happen". Even if the International Standard does not forbid a certain event, there are still other authorities, such as the laws of physics. I get a headache every time I read about those (in)famous 'nasal demons'. Yet, one might say that this headache is caused just by those demons waiting to fly out of my nose.
This is what I all the Shakespearian monkey fallacy.
Oh? I always called it a joke.
I *really* don't think that users of the phrase mean it to be taken literally.
We have told you at least a billion times, always exagerate the effects of UB.
BTW, you snipped the attributions of quoted material. Please don't.
Apologies to Dietmar. I shouldn't be allowed on a computer after 10PM.
--
Al Balmer
Sun City, AZ
"Al Balmer" <al******@att.net> wrote in message
news:nq********************************@4ax.com... On Sat, 3 Jun 2006 10:22:34 +0100, "Malcolm" <re*******@btinternet.com> wrote:
Undefined behavior, by the way, does also not mean "anything can happen". Even if the International Standard does not forbid a certain event, there are still other authorities, such as the laws of physics. I get a headache every time I read about those (in)famous 'nasal demons'. Yet, one might say that this headache is caused just by those demons waiting to fly out of my nose. This is what I all the Shakespearian monkey fallacy.
Oh? I always called it a joke.
I *really* don't think that users of the phrase mean it to be taken literally.
One of the characteristics of an identified fallacy is that there is some
group of people somewhere who do not fall prey to it.
How many people do you know who buy lottery tickets?
In the British National Lottery, the chance of getting the winning
combination is 14 million to one, and the jackpot not infrequently is over
14 million. Why do you think I still don't buy a ticket on these occasions?
--
Buy my book 12 Common Atheist Arguments (refuted)
$1.25 download or $7.20 paper, available www.lulu.com/bgy1mm
2006-06-04 <d6******************************@bt.com>,
Malcolm wrote: One of the characteristics of an identified fallacy is that there is some group of people somewhere who do not fall prey to it.
How many people do you know who buy lottery tickets? In the British National Lottery, the chance of getting the winning combination is 14 million to one, and the jackpot not infrequently is over 14 million. Why do you think I still don't buy a ticket on these occasions?
Because more people will buy tickets in those cases, increasing the
odds of multiple winners (cutting your winnings in half or worse) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Kevin Carne |
last post by:
First, Merry Christmas. I have been doing intensive Java programming for two years in school
(no choice on the language), but now I need to return to C++ because my resume is filled with
it both in...
|
by: theintrepidfox |
last post by:
Dear Group.
Wondered if any of you has any suggestion for the following?
Trying to install SQL Server 2005 Eval on a 'clean' machine. Well, my
mistake was probably that I had installed Visual...
|
by: perry.yuan |
last post by:
Hi there,
I got a problem: how to return an lvalue from conditional expression in
C programming language. Any solution or suggestion to my problem in
either C or C++ is welcome.
On the CPU...
|
by: cfriedalek |
last post by:
OK, I've asked this earlier this week with no response. Since then I've
also received a suggestion from the app developers but that failed with
the same type error problem. Hopefully Mark Hammond...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |