3 ms·
> why do pointers exist if you have references? Because references can't be NULL in C++, and you can't reseat a reference in C++. > why does printf exist? P
by maxlybbert 12y ago
> why do pointers exist if you have references?
Because references can't be NULL in C++, and you can't reseat a reference in C++.
> why does printf exist?
Personally, I think the more interesting question is "why isn't printf extensible?" And, with variable length template functions, it should now be extensible. If it were converted to a template.
> what is everything in the cstdlib?
I can't speak for all beginners, but I can say that when I was a beginner, the concept of language (and library) evolution was never hard for me to grasp. Even in a world where C never existed, I think I could have understood that some the library had old ways to do things, and new ways to do the same thing.
In fact, I can't think of any language that's been around for more than, say, ten years without a little cruft and duplication in the standard library.
- throwawayaway 12y agoI don't disagree with you, but I am arguing against people who say you don't need to understand C. If it were the case that the new ways were actually superior in all cases, then that point would stand, but in many they are not. It's a confederation of languages and pretending it isn't hinders people and their understanding.
- maxlybbert 12y agoI will admit that the textbook I learned C++ from didn't cover C-style string manipulation (other than to say it was error prone). It took a very long time for me to be comfortable doing any kind of string operation without first converting to a std::string. Nowadays I realize that there are often different answers to different questions, and it doesn't bother me.