Nп/п : 1 из 2
 От   : Blue-Maned_Hawk                     2:5075/128        27 сен 23 22:52:59
 К    : Richard Kettlewell                                    27 сен 23 01:57:03
 Тема : Libraries using longjmp for error handling (was: Re: More on NNTP testi
----------------------------------------------------------------------------------
                                                                                 
@MSGID:
f8f989c1@invalid.invalid> 283d3a9b
@REPLY: <wwvpm23d9fr.fsf@LkoBDZeT.terraraq.uk>
f466ab46
@REPLYADDR Blue-Maned_Hawk
<bluemanedhawk@invalid.invalid>
@REPLYTO 2:5075/128 Blue-Maned_Hawk
@CHRS: CP866 2
@RFC: 1 0
@RFC-Message-ID:
f8f989c1@invalid.invalid>
<65SQM.565977$9o89.411905@fx05.ams4><wwvpm23d9fr.fsf@LkoBDZeT.terraraq.uk>
span> @TZUTC: -0000
@PID: Pan/0.154 (Izium; 517acf4)
@TID: FIDOGATE-5.12-ge4e8b94
Richard Kettlewell wrote:

> It`s more than 20 years since I last had to integrate a C library which
> reported errors via longjmp() and I`m still bitter about it.

I have never encountered a library which does that.  Which library was 
that?

> As a matter of API design, I`d rather C library communicated errors via
> return values (and pointer parameters, where more complex error
> information is required).

Personally, i think that, at least for a library, an error should _only_ 
be communicated by return value.  If more complex information is required, 
then the return value can be made more complex.  I don`t think i`ve ever 
used a library that communicates information via a pointer parameter.

One thing i`ve experienced in multiple libraries is a system a bit like 
what errno.h offers, but done via a pair of subroutines that retrieve and 
assign to some hidden global variable.  I don`t like this for the same 
reason i don`t like subroutines that use errno (unless they`re syscall 
wrappers), but in at least two of the cases the library has also come with 
a way to set a callback subroutine to automatically deal with errors 
instead.  This is nice, since it means that the code doesn`t get all 
obfuscated with error checking after every subroutine call, but it`s 
annoying that each library needs to come with its own unique subroutine 
for this, and i do worry about it being overly general in treating all 
errors lethally.



-- 
Blue-Maned_Hawk?????????????shortens to 
Hawk?????????????/
blu.m??????in.d???????????????°ak/
?????????????he/him/his/himself/Mr. bluemanedhawk.github.io
Warning:  Low flying owls.  Lost chihuahua.
--- Pan/0.154 (Izium; 517acf4)
 * Origin: A noiseless patient Spider (2:5075/128)
SEEN-BY: 5005/49 5015/255 5019/40 5020/715 848 1042
4441 12000 5030/49 1081
SEEN-BY: 5058/104 5075/128 6078/80
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх