Source-Changes-D archive

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

Re: CVS commit: src/sys/uvm



On Fri, 12 Feb 2010, Masao Uebayashi wrote:
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.)

Replacing common code with a function sounds ok, but I've never seen either size or "importance" as justification of a goto.


 - Hubert


Home | Main Index | Thread Index | Old Index