DragonFly BSD
DragonFly kernel List (threaded) for 2005-02
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: setjmp/lonjmp (was: vinum warning)


From: "Greg 'groggy' Lehey" <grog@xxxxxxxxx>
Date: Wed, 16 Feb 2005 10:13:24 +1030

On Thursday,  3 February 2005 at 16:23:38 -0800, Matthew Dillon wrote:
>
>>>      I'm going to nit on this.
>>>
>>>      Using longjmp is evil.  Period.
>>
>> Is that the only justification you have for your opinion?
>
>     The problem, Greg, is that when you use something like that in a
>     large project you basically remove a large number of programmers
>     from the set of programmers able to work, maintain, and extend
>     your code.

That's a secondary issue.  Not that I disagree, but my question was
related to the construct only.  What you say below is interesting, but
not what I was talking about.

>     Your code is especially difficult to maintain.  I'm not saying
>     its bad, just that it's especially difficult for people other
>     then yourself to wrap their hands around and actually work with
>     because of the lack of in-code documentation, weird code
>     constructions that nobody else uses, weird indentation that
>     doesn't seem to work with anyone else's editor, the extremely
>     deeply nested statements you have, lack of compartmentalization
>     of major function sets, and other things.  I've tried to do
>     cleanups of your vinum code before and, believe me, it is a
>     frustrating experience!

Sorry to hear about it.  Yes, I agree, I don't exactly adhere to
style(9).  That's because I consider style(9) to be outdated.  But
it's clear that it doesn't make my code any easier to read for those
people who are used to style(9).

>     Now, so you don't feel bad, Kirk's code comes in a close second.

Heh.  I don't feel bad :-)  But thanks, anyway.

>     It's probably a generational thing.  One of the reasons why I am
>     allowing people to do major cleanups of our code base is
>     precisely to try to make the code more maintainable and more
>     comfortable for more recent generations of programmers.

Paradoxically (as I said above), I think the current code style is
older.  To get back to the topic, I think that setjmp/longjmp is a
more modern construct.  Admittedly it's (marginally) more difficult to
understand setjmp/longjmp than it is to understand a chain of function
returns, and there's additional potential to break something, but I
don't see either of these as serious, and I do see the advantages as
significant, particularly in the untidy area of checking return codes
at every step.  You obviously don't, and I was asking about your
reasons.

Greg
--
When replying to this message, please copy the original recipients.
For more information, see http://www.lemis.com/questions.html
Finger grog@xxxxxxxxx for PGP public key.
See complete headers for address and phone numbers.

Attachment: pgp00017.pgp
Description: PGP signature



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