Messages in this thread | | | Date | Tue, 02 Nov 2004 14:08:00 -0600 | From | Chris Friesen <> | Subject | question on common error-handling idiom |
| |
There's something I've been wondering about for a while. There is a lot of code in linux that looks something like this:
err = -ERRORCODE if (error condition) goto out;
While nice to read, it would seem that it might be more efficient to do the following:
if (error condition) { err = -ERRORCODE; goto out; }
Is there any particular reason why the former is preferred? Is the compiler smart enough to optimize away the additional write in the non-error path?
Chris - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |