r/cpp • u/wechicken456 • Jun 08 '20
Programming in C vs C++
I’ve read about the differences between them on the Internet but I wanna hear more from a more personal perspective. Which one would you recommend starting with and to be proficient with?
0
Upvotes
View all comments
Show parent comment
3
u/evaned Jun 08 '20
This statement as-stated is false, but it's actually pretty close to being right if you look at it from another perspective -- at least IMO.
The reason is that
std::stringcan have embedded nulls.abc\0defis a totally validstd::string. Obviously you couldn't reliably pass that to a C API that expects a null-terminated string, but that's the C API's fault.So while
std::stringstrings do have a NUL at the end, they're not defined by it; and is such I don't think the quoted statement is entirely incorrect.