Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

IMO error objects should’ve included a pointer to some extra preallocated memory.

In my C code I always allocate my error objects first, with usually 1024 bytes just for error strings.

In cases where i don’t care for error strings, i allocate 0 bytes for them.

I have a simple function to append error strings, and it checks for space. So all the code is ambivalent about whether this extra space exists.

works wonderfully.



Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: