News for hackers. Stuff that matters.
Re:Why aren't there C conferences? (2018) by up2isomorphism on Saturday August 27, 2022 @10:00AM (#32619109)
Null terminated string are never meant to use for large buffers. For all small strings that just locally it serves its purpose nicely. C designer realized that there is no way to have a standard way to deal with large performance-critical buffers , so they choose not to do it. Which is exactly the reason why C is so powerful - not necessarily fast but never get in your way if you want to.

For array bounds checking, if you want it, just a write a structure with buffer length and a getter setter and it is done. People complain this write zillions of getter setters in other languages but just choose to complain in case for C.

Re:Why aren't there C conferences? (2018) by WalterBright on Saturday August 27, 2022 @12:10PM (#32620502)
> For array bounds checking, if you want it, just a write a structure with buffer length and a getter setter and it is done.

It's so easy, yet buffer overflows remain the #1 problem in shipped C code.

> For all small strings that just locally it serves its purpose nicely.

Not really. Whenever I review other peoples' C code, I look at their use of strlen/strncpy/strxxx functions. They're a rich source of bugs, and I'll usually find one in it (usually an off-by-one error). They don't have to be large strings, either, to be slow.

Re:Why aren't there C conferences? (2018) by up2isomorphism on Sunday August 28, 2022 @11:14AM (#32629021)
It just means not that many people give a damn about buffer overflows anyway. And put that situation to language’s fault just doesn’t make sense.

You are saying C string is slow, I am telling you short local strings are not slow, please tell me why it is slow in that case?