Reply to post: Re: If you want to do Low-Latency properly ...

Wake me up before you go Go: Devs say they'll learn Google-backed lang next. Plus: Perl pays best, Java still in demand

DrXym

Re: If you want to do Low-Latency properly ...

C doesn't have strings AT ALL. That's the problem. There is no intrinsic string type of any kind. Instead you have a pointer to a char and the "string" is all the chars before a nul char.

As you say it has caused all kinds of overflow issues. A trivial one is a buffer too short to copy the string into, or off by one byte for the nul char. And even though C has "safe" string functions, it never bothered to remove the unsafe ones. So the likes of strcpy are still there as an attractive nuisance.

The situation is somewhat better in C++ but it doesn't have a string intrinsic either. Instead it has a std::string template class. This maintains the length of string as well as the string itself so it doesn't rely on a nul char but it sticks a \0 on the end anyway for c_str().

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon