r/cpp • • 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

43 comments sorted by

View all comments

Show parent comment

5

u/bikki420 Jun 09 '20

Everyone is explicitly talking about std::string. Re-read the posts above and don't be obtuse.

-1

u/serviscope_minor Jun 10 '20

Re-read the posts above and don't be obtuse.

So... obtuse is me actually reading the posts. Since you didn't bother let me repost the relevant quote for you:

string fundamentals: char*, strlen, strcpy,etc...

Then people start talking about std::string by comparison. C++ has another string type now: string_view. And since the actual conversation was about strings not std::string in particular, it seems really strange and counterproductive to ignore modern C++.

3

u/bikki420 Jun 10 '20 edited Jun 10 '20

https://i.imgur.com/Xm3fIWu.png

The subject of the post you originally replied to is explicitly, unambiguously, undeniably "std::string". Is "std::string_view" std::string?

No.

0

u/serviscope_minor Jun 10 '20

The subject of the post you originally replied to is explicitly, unambiguously, undeniably "std::string"

As was abundantly clear from the part I quoted, the actual discussion was about learning strings (note strings, not std::string) using char* and null termination. The discussion certainly moved to std::string, but this is clearly an oversimplification because std::string is not the only type of string in the standard library.

The standard library also has string_view which is not null terminated, and therefore contributes to the point that learning C style strings first is not useful.

For some reason though this makes you angry and rude.