Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Goto's are used extensively in the Linux kernel for clean exits from functions (typically system calls) that must validate parameters, allocating resources as they go, but then abort if there are any errors in the parameters. For example: http://lxr.free-electrons.com/source/kernel/fork.c?v=3.3#L42...


In Go, defer basically serves this use case.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: