4 ms·
> One of the things that hampers C is its string processing. That's not a language, but a library issue. String handling in C is only as sucky as the library y
by cygx 15y ago
> One of the things that hampers C is its string processing.
That's not a language, but a library issue. String handling in C is only as sucky as the library you're using...
- Roboprog 15y agoKind 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/bzrt_bytes.h 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.
- jebblue 15y agoBig 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';