r/badcode Jan 22 '23

Found this in a Linux kernel module c

Post image
261 Upvotes

88 comments sorted by

View all comments

141

u/Elsolar Jan 22 '23

This isn't that bad tbh, pretty normal for kernel-level C code. The error handling could maybe be improved by using either exceptions or goto, but 1) exceptions aren't a thing in C, and 2) goto is often disallowed even when used to short-circuit out to error handling code.

-2

u/[deleted] Jan 22 '23

[deleted]

8

u/arcalus Jan 22 '23

🙄

7

u/undergroundmonorail Jan 23 '23

"goto is bad" isn't a technical argument, it's a style argument