From: Jagadeesh Bhaskar P <jbhaskar@hclinsys.com>
To: Linux C Programming <linux-c-programming@vger.kernel.org>
Subject: help for using setjmp and longjmp functions
Date: Mon, 20 Dec 2004 12:38:11 +0530 [thread overview]
Message-ID: <1103526490.4005.3.camel@myLinux> (raw)
Hi,
I tried writing a simple program to findout usage of setjmp and
longjmp() functions. The program ran in an infinite loop showing some
warnings. What is the problem? Can someone help me depicting the
behaviour of the setjmp and longjmp functions
/******** beginning of code *************/
#include <setjmp.h>
jmp_buf jmpbuffer;
void bar(void)
{
printf("inside bar\n");
longjmp(jmpbuffer, 1);
}
void foo(void)
{
printf("before calling bar()\n");
bar();
printf("after calling bar()\n");
}
int
main(void)
{
printf("before calling foo()\n");
if(setjmp(jmpbuffer)!=0)
perror("error setting");
foo();
printf("after foo()\n");
return 0;
}
/**************** end of code ***********/
Hoping for help
TIA..
--
With regards,
Jagadeesh Bhaskar P
next reply other threads:[~2004-12-20 7:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-20 7:08 Jagadeesh Bhaskar P [this message]
[not found] <50C05B7AA7D6924FB5E384EF14BC647B495EE4@inba1mx2.corp.emc.com>
2004-12-20 7:54 ` help for using setjmp and longjmp functions Jagadeesh Bhaskar P
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1103526490.4005.3.camel@myLinux \
--to=jbhaskar@hclinsys.com \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).