Hacker News new | past | comments | ask | show | jobs | submit login

'Assert early and often'. Check your assumptions all the time, nine out of ten times that's where your bugs will hide.



My C programs always start as a few skeleton .h files with include guards, and a few .c files that are basically an ever growing list of asserts() on any pointer to a structure or variable, or on any value where it is expected to be within a certain range.

Gradually I feed my structs and typedefs into the .h files and replace the asserts with (hopefully) working code.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

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

Search: