kernel32: Implement ReplaceFileW

Michael Stefaniuc mstefani at redhat.com
Fri Feb 8 05:32:19 CST 2008


luis.busquets at ilidium.com wrote:
> I have read this patch sent in several times and have realised that every
> time it contains a large number of "goto"'s.
> 
> I certainly do not like "goto" in structured code.
> My question to the forum is if it is allowed to use "goto" in wine or if
> you prefer not to use it.
Wine takes the right (TM) approach to goto: the non ideological one:
goto is fine for handling a lot and complex cleanups needed on error
paths. You always need to balance the advantages and disadvantages of
goto: does the goto make the code more readable and clear? If yes use
the goto if not then don't.
See also Donald Knuth paper "Structured Programming with Goto
Statements" http://pplab.snu.ac.kr/courses/adv_pl05/papers/p261-knuth.pdf

> Even when this will make the code larger but it may give a little nore
> readability,
No, it doesn't increase readability it decreases readability a lot.
Especially as you have to replace "goto error:" with deeply nested
if/else code and that is not readable at all.
Using goto right is an art; you need to look at the code and say that it
looks good.

bye
	michael
-- 
Michael Stefaniuc                           Tel.: +49-711-96437-199
Consulting Communications Engineer          Fax.: +49-711-96437-111
--------------------------------------------------------------------
Reg. Adresse: Red Hat GmbH, Hauptstätter Strasse 58, 70178 Stuttgart
Handelsregister: Amtsgericht Stuttgart HRB 153243
Geschäftsführer: Brendan Lane, Charlie Peters, Michael Cunningham,
                 Werner Knoblich



More information about the wine-devel mailing list