Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Kind of bound to the semantics, though.

E.g. -

memset( s, '\0', sizeof( s) );

s[ 0 ] = '\0';

You can of course create a library (e.g. https://github.com/roboprog/buzzard/blob/master/bzrt/src/bzr...) to support alternate implementations (as interpreters and VMs created in C must), but it's not really much like ANSI C anymore.



Big difference here between these two, check out a copy of "Deep C Secrets" by Peter van der Linden.

This is ok, safe, complete, reliable:

memset( s, '\0', sizeof( s) );

This yields the perception that it works, depending on what is going to make use of s later on, it could fail to do what you intended depending on how you use s:

s[ 0 ] = '\0';




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: