Hacker News new | ask | show | jobs
by mobilemidget 2250 days ago
Could you add some extra information why this is so helpful or handy to have? Think it will benefit readers that are starting out with C etc.
2 comments

In C, dynamically-sized vectors don’t carry around size information with them, often leading to bugs. This struct attempts to keep the two together.
Memory corruption in sudo password feedback code happened because length and pointer sit as unrelated variables and have to be manipulated by two separate statements every time like some kind of manually inlined function. For comparison putty slice API handles slice as a whole object in a single statement keeping length and pointer consistent.