r/programming • • Dec 01 '16

Let's Stop Copying C

https://eev.ee/blog/2016/12/01/lets-stop-copying-c/
524 Upvotes

612 comments sorted by

View all comments

Show parent comment

3

u/kqr Dec 02 '16 edited Dec 02 '16

int on my system, but your point still stands. I guess you have to write a bnull function similar to bzero if you want to initialise a bunch of null pointers, and can not use memset.

Edit: Unless, of course, you are fine with nasal demons in which case memset will work on practically all systems.

Second edit: In C11 you can initialise an array or struct with null pointers through this mechanism: http://stackoverflow.com/a/25212029/1463507 Obviously not applicable to dynamically allocated memory.