News for hackers. Stuff that matters.
Re:Memory Safety for Web Fonts by hombre_fatal on Wednesday March 19, 2025 @01:02PM (#43414559)
On the other hand, parceling a large function into smaller functions can create indirection that is even harder to follow and harder to verify as bug-free.
Re:Memory Safety for Web Fonts by acdha on Wednesday March 19, 2025 @01:29PM (#43414914)
Maybe, but it usually has the opposite effect. If you have well-designed and named functions the indirection is a feature since it reduces the amount of context you need to remember and gives you a visible contract instead of having to reason about a large block of code.
Re:Memory Safety for Web Fonts by nyanpasu64 on Thursday March 20, 2025 @12:42AM (#43419942)
This works if you know what each callee performs, which you frequently don't when you're visiting a new codebase (it may have an unknown function you have to read to know, functionality not relevant to your problem, or you may have to analyze two or more functions in the context of each other to understand a bug).
Re:Memory Safety for Web Fonts by kmoser on Wednesday March 19, 2025 @02:35PM (#43415716)
Also, the act of breaking it into smaller functions itself may introduce more bugs.
Re:Memory Safety for Web Fonts by graemep on Thursday March 20, 2025 @12:18PM (#43425234)
Yes, rewrites are risky, but I really meant not writing such large functions in the first place.