What are some good tools to make C programming more memory safe? Maybe not to the level of rust but closer. Especially looking for any libraries to write safer code.
What are some good tools to make C programming more memory safe? Maybe not to the level of rust but closer...
Other urls found in this thread:
youtube.com
clang.llvm.org
twitter.com
how do i learn c
Static analyzers
I sometimes use valgrind to double check but I just code with memory management in mind when I use languages like C
valgrind
hmm maybe a garbage collector? it's a bit of overhead though.
MISRA C
allocate all memory on program startup, simple as
Don't use variables.
Follow classic fortran variable naming conventions.
Your brain.
One of NASA's requirements for deep space probe software.
learnxinyminutes. com/docs/c/
basically what all safety critical embedded things I've worked on do
Pretty easy to make checks for dynamic memory however to ensure you aren't going out of bounds, or that you have a memory leak by simply substituting your malloc/realloc/free calls with debug functions that count everything, and additionally over-allocate to ensure you aren't overrunning. Anything not caught by that is a logic error that you've missed in your tests and leads to bad state anyways, so not the fault of dynamic memory
Can you name some?
The fact there are people who unironically think that MISRA C is a tool that makes C safer speaks volumes to how retarded this board has gotten.
Zig. Less UB. Better error handling. Better pointers. Better arrays. Slices. Keep run-time safety on and it will catch most problems. Use the GPA to detect improper allocations & leaks.
-fsanitize=address is the simplest and most effective thing you can do.
Just putting it out there in case you are not using it for some reason.
Looking through this guys websites, can't tell if he's a genius or a retarded autist
rustc
A brain for starters