Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > setjmp,longjmp, sigsetjmp implementation

Reply
Thread Tools

setjmp,longjmp, sigsetjmp implementation

 
 
Nick Keighley
Guest
Posts: n/a
 
      12-16-2012
On Dec 11, 11:36*am, "Borneq" <bor...@antyspam.hidden.pl> wrote:

> Where I can find setjmp,longjmp, sigsetjmp implementation? In GCC source I
> can't find.


Plauger's Library Book discusses setjmp and longjmp implementation

http://www.amazon.co.uk/Standard-C-L...dp/0131315099/

and its great book to read anyway
 
Reply With Quote
 
 
 
 
Tim Rentsch
Guest
Posts: n/a
 
      12-17-2012
Nobody <> writes:

> On Wed, 12 Dec 2012 15:19:57 +0100, Johann Klammer wrote:
>
>> Doesn't the whole machine state have to be
>> saved/restored(registers/Fp/SSE/flags etc)?

>
> No.
>
>> What if the calling function was using some regs for local vars etc ?!...

>
> 7.13.2.1p3:
>
> All accessible objects have values as of the time longjmp was
> called, except that the values of objects of automatic storage
> duration that are local to the function containing the
> invocation of the corresponding setjmp macro that do not have
> volatile-qualified type and have been changed between the
> setjmp invocation and longjmp call are indeterminate.
>
> gcc will warn about such cases with e.g.:
>
> warning: variable 'foo' might be clobbered by 'longjmp' or 'vfork'


A herring was never redder.

> Typically, only the "essential" registers (program counter, stack pointer,
> frame pointer) are preserved. Registers holding local variables or
> intermediate results aren't required to be preserved (and usually aren't).
> [snip unrelated]


This is nonsense. Any register holding a live value at the time
of the call to setjmp must be preserved, and restored by longjmp.
Most commonly that will be most or all the registers.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insertion Sort : C++ implementation 100 times slower than C implementation sanket C++ 7 11-03-2011 05:00 AM
Knowing the implementation, are all undefined behaviours become implementation-defined behaviours? Michael Tsang C Programming 54 03-30-2010 07:46 AM
Knowing the implementation, are all undefined behaviours become implementation-defined behaviours? Michael Tsang C++ 32 03-01-2010 09:15 PM
can anyone guide me in flight-mode implementation for Windows mobile 5.0? vivekanand holla Wireless Networking 1 11-10-2005 11:15 AM
transport protocol implementation in NDIS zenhwa Wireless Networking 0 09-14-2004 11:38 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57