bug-myserver
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-myserver] [PROPOSAL] Exception management scheme


From: Daniele
Subject: Re: [bug-myserver] [PROPOSAL] Exception management scheme
Date: Sun, 28 Mar 2010 18:11:01 +0200

Hi! :)
Well, my only comment is related to the CHECK_CONDITION() system, on which I briefly answered earlier. I'll try to explain more clearly why I think that a function or a macro is not a choice I like best.

First, it seems to me like a really heavy "notation", which would make some pieces of code difficult to read (and IMO the overall look of the code is an important factor in a project).

Moreover, the errno symbol value (as stated on the man page: http://linux.die.net/man/3/errno) "is significant only when the call returned an error": making a single macro or function would imply writing a routine which first checks the return code of a system call, and then checks the value of errno. But, since the system calls can return an arbitrary value  - even negative values, such as in the case of the getpriority() call (http://www.kernel.org/doc/man-pages/online/pages/man2/getpriority.2.html) - a single "god-like" function which handles all the possible cases would have to first reset the errno symbol value to EOK (or 0), then evaluate the requested _expression_, and finally check back the errno symbol value to detect for a possible error condition, and subsequently raise the correct exception. It would be possible with a macro, but it's tricky nonetheless. =)

I find a more natural approach to define "aliases" of the syscalls in a separate namespace, so that the readibility is not heavily impacted and the goal of handling system calls failures with exceptions is accompished in a custom way for every function.
To reduce code duplication, one may set up a map of factory methods that create exceptions according to the errno-code they are associated with.

I'm sorry for the length of the message, and I beg your pardon if something is not explained clearly: I'll be glad to answer and clear your doubts, if this is the case.

Cheers,
Daniele

2010/3/28 Giuseppe Scrivano <address@hidden>
Hello Lisa,

As we already discussed privately, it looks like a good proposal and I
agree on everything.

Does anyone have comments?

Cheers,
Giuseppe

reply via email to

[Prev in Thread] Current Thread [Next in Thread]