From: kohaerenzstifter@posteo.de (Martin Knappe) Date: Fri, 17 Jul 2015 11:22:58 +0200 Subject: =?UTF-8?Q?goto=3F=3F=3F?= In-Reply-To: References: <20150717075555.GA29600@debian> <7290c20fdca267b5f7dae838466b2c3d@posteo.de> Message-ID: <7933ea7ccd079d6e1aef32c0f70400e2@posteo.de> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org I'm just messing ... I guess I felt a bit challenged by your "try to write that without using goto" I use goto myself very much for function cleanup. I wouldn't normally code the way I did in that snippet. Apart from that, my general rule for any function is: 1) Only ONE return statement. 2) Only ONE cleanup label to goto in case of an error. Call that label "finish", ALWAYS. Am 17.07.2015 11:13 schrieb Sudip Mukherjee: > On Fri, Jul 17, 2015 at 2:18 PM, Martin Knappe > wrote: >> Very easy: > Looks good. :) > But for me, now while reading the code I have to keep a note of the > value of cleanupState variable and the error path becomes confusing. > And besides in your opinion now which code is more readable, the > original > code or this one? > > regards > sudip