|
|
|
|
|
by viperscape
3052 days ago
|
|
Having learned Rust and used it for nearly 2 years, I am now happy using C. I think most issues in C are easily catchable. Here me out: 1. If using Int for indexing or any sort of len or count, make sure it's positive when needed, and within bounds of what's allocated. As in if you plan on allocating huge data, plan it out and use the right data type. 2. If you alloc, then free when done. If you free, set to Null; and before you free, check for Null. 3. If you realloc, in particular, check that it actually worked and prepare for basic error handling. Rust requires all of these steps by default. Finally, just test some of your code. Rust makes this easy, and encourages it. I still really like C. |
|