Source-Changes-D archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/sys/uvm
>> Log Message:
>> uvm_fault_internal: Skip another long code segment (lower "neighbor" fault)
>> by a goto.
>>
>>
>> To generate a diff of this commit:
>> cvs rdiff -u -r1.133 -r1.134 src/sys/uvm/uvm_fault.c
>
> Isn't this what the compiler would make anyways,
> and making the code harder to read?
> There's a reason modern programming doesn't advocate "goto"s...
I used goto there because it had the if-indented block a) was long, b) had
an important sequence of code, and c) had a very similar code fragment in
the same file. So the intent was to make the block into a function, reduce
unnecessary differences, then kill code duplication. (The current code is
not in a good shape yet.)
In general, goto is useful in kernel, especially where you need to meet
conditions at some exit point (free memory, exit mutex, etc.). Such a code
should be coded very carefully, and done so in UVM.
Masao
--
Masao Uebayashi / Tombi Inc. / Tel: +81-90-9141-4635
Home |
Main Index |
Thread Index |
Old Index