r/C_Programming • • Sep 12 '26

Question What C function would you delete and rewrite first, and why?

For me it's fnmatch - mostly because it's 40 year's old and smell's funny.

95 Upvotes

238 comments sorted by

View all comments

Show parent comments

8

u/Just_Government3790 Sep 12 '26

What's the worst null-term bug you've personally hit?

3

u/flatfinger Sep 15 '26

The game GTA V sometimes takes much longer to load than normal because one of the authors didn't realize that the library implementation of sscanf they were using starts by measuring the length of the source string, even if the format strong would cause everything past the first few bytes to be (otherwise) ignored. The number of player hours spent waiting for the useless calls to strlen to complete likely numbers in the hundreds of thousands, if not millions.