Re: goto???

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

 



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
> <kohaerenzstifter@xxxxxxxxx> 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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux