r/C_Programming • u/Just_Government3790 • Sep 12 '26
Question What C function would you delete and rewrite first, and why?
For me it's fnmatch - mostly because it's 40 year's old and smell's funny.
95
Upvotes
View all comments
Show parent comment
1
u/Dangerous_Region1682 Sep 15 '26
But in kernel space you don’t write things like that. You tend to write code that is much more allied to what you want the assembler to look like. If you are setting breakpoints and you set them in the kernel debugger you don’t want to be searching around for code to only find it’s been optimized away. It’s hard enough to trace what’s happening with multi threaded kernel code without having clever optimizations of cleanly omitted code. It’s confusing and takes time to figure out what the difference between what I wrote and what the compiler generated when I’m looking at the assembler with the kernel debugger. What if the argument to test() was a pointer to something in the data segment that was being modified by another thread which might not be the case in this artificial example but nevertheless?