4 ms·
There are actually very few _dangerous_ functions in C (gets is the only one that comes to mind). Others have massive caveats (strncpy) but still have their pl
by syncsynchalt 6y ago
There are actually very few _dangerous_ functions in C (gets is the only one that comes to mind). Others have massive caveats (strncpy) but still have their place. Others are just known to have certain gotchas (strcpy, strcat, sprintf).
The reality of C is that if we deprecated every objectionable function in the stdlib we wouldn't have anything left.
- a1369209993 6y ago> There are actually very few _dangerous_ functions in C I think you mean there are very few functions that cannot possibly be used correctly (namely gets). Most C functions are dangerous - can lead to crashes and security vulnerabilties if used incorrectly - but that's just a expected consequence of using a language with no provisions for memory-safety. > The reality of C is that if we deprecated every objectionable function in the stdlib we wouldn't have anything left. Somewhat ironically, malloc is actually perfectly safe[0] - using the return value has some issues, but calling it is always[0] fine. 0: Assuming the OS-level memory allocator is sanely configured WRT overcommit, anyway.