News for hackers. Stuff that matters.
Re:C’s Biggest Mistake by umanwizard on Sunday July 02, 2023 @09:47PM (#36567744)
AFAICT you’d either have to pass the length at runtime somehow, or treat the function as a generic/template and generate a separate version for each separate N it’s called with. The latter would be pretty far from the ethos of C, imo.
Re:C’s Biggest Mistake by usefulcat on Sunday July 02, 2023 @10:31PM (#36568021)
> AFAICT you’d either have to pass the length at runtime somehow

This is exactly the solution proposed in TFA..

Re:C’s Biggest Mistake by chongli on Sunday July 02, 2023 @10:16PM (#36567913)
This could be done by storing the length of the array before the first element. It wouldn’t even need to be done in all cases, only if the length is actually used.