🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by a j cornah Thu, 23 Jul 1992 15:55
Request for information about setjmp/longjmp in g++
#103
Author: a j cornah
Date: Thu, 23 Jul 1992 15:55
37 lines
2141 bytes
I have been looking at providing a similar feature to Ada EXCEPTIONs in
Modula-2, C and C++. What I need to do this reasonably cleanly is a
facility which works like "setjmp" but for one routine down:

a()
{
    if (b() != 0)
    {
        printf("Something happened\n");           <----------+
        return;                                              |
    } /* endif (b() != 0) */                                 |
    c();                                                     |
}                                                            |
                                                             |
int                                                          ^
b()                                                          |
{                                                            |
    return( MYsetjmp(buffer) );                              |
}                                                            |
                                                             |
c()                                                          |
{                                                            |
    longjmp(buffer); /* This returns to the code up here  ->-+
                      * rather than being wrong because b
                      * has already returned
                      */

In TURBO C++ I can obtain the source of the runtime library and modify the
setjmp code to save the value of the previous stack frame fairly easily.
I had a quick look at the source of g++ but it wasn't obvious whether I could
do the same and expect the same result.

Could you please tell me where to look for the code I need?

Thanks in anticipation of a reply

Tony Cornah
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads