473,385 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

what is setjump() ?

Hello,

So far, setjump() was never used in any of my programs...
Is it portable? where its usage mostly fits?

Was it exception catching mechanism just as exception handling now exist in
decent languages?

--
Elias
Nov 14 '05 #1
4 6073
"lallous" <la*****@lgwm.org> wrote:
# Hello,
#
# So far, setjump() was never used in any of my programs...
# Is it portable? where its usage mostly fits?
#
# Was it exception catching mechanism just as exception handling now exist in
# decent languages?

In Algol 60, procedures can be nested, and a goto from an interior procedure
can have a label in a containing procedure.

procedure A; begin
procedure B; begin
procedure C; begin
goto X;
end;
...
C;
end;
C;
W: ...
X: ...
end;

will continue at X not W. Because C does not have nestable procedures,
a more complicated mechanism was created.

--
Derk Gwen http://derkgwen.250free.com/html/index.html
What kind of convenience store do you run here?
Nov 14 '05 #2
In article <10*************@corp.supernews.com> Derk Gwen <de******@HotPOP.com> writes:
"lallous" <la*****@lgwm.org> wrote:
# So far, setjump() was never used in any of my programs...
# Is it portable? where its usage mostly fits?
#
# Was it exception catching mechanism just as exception handling now exist in
# decent languages?

In Algol 60, procedures can be nested, and a goto from an interior procedure
can have a label in a containing procedure.

procedure A; begin
procedure B; begin
procedure C; begin
goto X;
end;
...
C;
end;
C;
W: ...
X: ...
end;

will continue at X not W. Because C does not have nestable procedures,
a more complicated mechanism was created.


While the Algol 60 part is correct, the C mechanism is quite a bit more
than just a jump to another, calling procedure. It is intended to trap
all kinds of error conditions, something Algol 60 could not.

Nesting of procedures and jumping out of inner procedures is something
different from trapping on error conditions.
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
Nov 14 '05 #3
# While the Algol 60 part is correct, the C mechanism is quite a bit more
# than just a jump to another, calling procedure. It is intended to trap
# all kinds of error conditions, something Algol 60 could not.

procedure A; begin
switch AX := X;
procedure B(eexit); switch eexit; begin
C(eexit);
...
end;
procedure C(eexit); switch eexit; begin
switch CX := Y;
D(CX);...; D(eexit);...
...
Y: ... ; goto eexit[1];
end;
procedure D(eexit); switch eexit; begin
switch DX := Z;
...
goto DX[1];
...
Z: ... ; goto eexit[1]
end;
B(AX);...;C(AX);...;D(AX);...
X: ...
end;

# Nesting of procedures and jumping out of inner procedures is something
# different from trapping on error conditions.

CAR Hoare "Here is 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."

--
Derk Gwen http://derkgwen.250free.com/html/index.html
You hate people.
But I love gatherings. Isn't it ironic.
Nov 14 '05 #4
In article <10*************@corp.supernews.com> Derk Gwen <de******@HotPOP.com> writes:
# While the Algol 60 part is correct, the C mechanism is quite a bit more
# than just a jump to another, calling procedure. It is intended to trap
# all kinds of error conditions, something Algol 60 could not.

procedure A; begin
switch AX := X;
procedure B(eexit); switch eexit; begin
C(eexit);
Nowhere in this example the trapping of error conditions is present.
So I do not understand the purpose. [ Remainder snipped.]
# Nesting of procedures and jumping out of inner procedures is something
# different from trapping on error conditions.

CAR Hoare "Here is 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."


Except that you could not trap on error conditions. Moreover, there
were strange constructs like Jensen's device and:
"begin"
"procedure" B(x, b); "Boolean" b;
"begin"
"if" b "then" "goto" b "else" z := z + b;
"end";
"integer" z;
z := 0;
B(5, "false");
B(5, "true");
B(5, "false");
5:
"end"
where a procedure acts more like a macro than like a real procedure.
(And, yes, I know of at least one compiler that did this correct.
Most compilers did not allow it.)
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
Nov 14 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: thecrow | last post by:
Alright, what the hell is going on here? In the following code, I expect the printed result to be: DEBUG: frank's last name is burns. Instead, what I get is: DEBUG: frank's last name is...
220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
92
by: Reed L. O'Brien | last post by:
I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike but with better encryption?...
137
by: Philippe C. Martin | last post by:
I apologize in advance for launching this post but I might get enlightment somehow (PS: I am _very_ agnostic ;-). - 1) I do not consider my intelligence/education above average - 2) I am very...
12
by: Dario | last post by:
The following simple program behaves differently in Windows and Linux . #include <stdexcept> #include <iostream> #include <string> using namespace std; class LogicError : public logic_error {...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
47
by: Neal | last post by:
Patrick Griffiths weighs in on the CSS vs table layout debate in his blog entry "Tables my ass" - http://www.htmldog.com/ptg/archives/000049.php . A quite good article.
6
by: pal | last post by:
hi all, Can anybody explain about setjump and longjump functions if u have time to spend on this. Thanks, pal
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.