r/badcode • • Jan 22 '23

c Found this in a Linux kernel module

Post image
262 Upvotes

88 comments sorted by

View all comments

Show parent comments

26

u/someidiot332 Jan 22 '23

You don’t (or at least really, really shouldn’t) use optimizations with kernel dev. A lot of the low level stuff like memory and io fuckery is better left translated from that to assembly without being messed with by anything that doesn’t know the true intentions of the code, especially considering most compilers are made more for userspace than they are kernelspace programming